如何从WINSCP会话日志中获取特定的文件传输数据

发布于 2025-02-01 10:31:51 字数 1756 浏览 3 评论 0原文

我有一个来自.bat脚本的日志,该日志从两个独立的WINSCP文件夹下载文件,然后将文件从WINSCP删除,然后将其下载到Azure服务器上的特定文件夹中。我只想查看从WINSCP下载到Azure服务器的日期,时间和文件,而不是日志中的所有其他数据。有办法这样做吗?从我自己的研究中,我看到人们建议使用PowerShell脚本或使用GREP命令,但这不会产生日志,我可以每天回顾一下,该日期仅指定日期文件的拉动,时间和下载了哪些特定文件以及从WINSCP删除?

日志示例:

. 2022-05-20 17:56:56.078 WinSCP Version 5.19.6 (Build 12002 2022-02-22) (OS 10.0.17763 - Windows Server 2019 Datacenter)
. 2022-05-20 17:56:56.079 Configuration: nul
. 2022-05-20 17:56:56.079 Log level: Normal
. 2022-05-20 17:56:56.079 Local account: NA\rustyshakelford01
. 2022-05-20 17:56:56.079 Working directory: C:\SftpScripts
. 2022-05-20 17:56:56.079 Process ID: 18964
. 2022-05-20 17:56:56.094 Ancestor processes: WinSCP, cmd, explorer, ...
. 2022-05-20 17:56:56.095 Command-line: "C:\Program Files (x86)\WinSCP\WinSCP.exe" /console=5.19.6 /consoleinstance=_25988_652 "/log=C:\SftpScripts\Log\WinSCP.log" "/ini=nul" "/command" "open sftp://THR1:***@12.50.9.55/ -hostkey=""ssh-rsa 1024 h/hAIAyM00g7C85w9sSGKlutqsjrCf/ka8ZxD9hPKZw=""" "cd /sftp.DALE.org/usr/RUSTY/835/Test" "lcd ""E:\Raw Client Data Files\THR\Automated Pull Down - Not Processed\835""" "get -delete /sftp.DALE.org/usr/RUSTY/835/Test/*" "exit"
. 2022-05-20 17:56:56.095 Time zone: Current: GMT+0 (Coordinated Universal Time), No DST

我想从日志中提取的数据/行会说类似的话:

 2022-05-25 20:58:26.195 File: '/sftp.DALE.org/usr/RUSTY/835/From_THR/Send to Rusty Mar 2022 Whole and JV Epic only/TEST_68069NON2022033111220600X_MCDMCD' [2022-05-24T20:24:18.000Z] [1432]

. 2022-05-25 20:58:26.196 Copying "/sftp.DALE.org/usr/RUSTY/835/From_THR/Send to Rusty Mar 2022 Whole and JV Epic only/TEST_68069NON2022033111220600X_MCDMCD" to local directory started.

我相信它提供了一个成功复制到正确文件夹的文件的示例。希望这能提供更多的见识。

I have a log from a .bat script that downloads files from two separate WinSCP folders and then deletes the files from WinSCP and downloads them to a specific folder on an azure server. I wanted to only see the date, time, and files of the specific files downloaded from WinSCP to the azure server as opposed to all of the other data in the log. Is there a way to do this? From my own research, I've seen people suggest PowerShell scripts or using the grep command but that won't produce a log I can look back at daily that just specifies the date files were pulled, the time and what specific files were downloaded and deleted from WinSCP?

Log Example:

. 2022-05-20 17:56:56.078 WinSCP Version 5.19.6 (Build 12002 2022-02-22) (OS 10.0.17763 - Windows Server 2019 Datacenter)
. 2022-05-20 17:56:56.079 Configuration: nul
. 2022-05-20 17:56:56.079 Log level: Normal
. 2022-05-20 17:56:56.079 Local account: NA\rustyshakelford01
. 2022-05-20 17:56:56.079 Working directory: C:\SftpScripts
. 2022-05-20 17:56:56.079 Process ID: 18964
. 2022-05-20 17:56:56.094 Ancestor processes: WinSCP, cmd, explorer, ...
. 2022-05-20 17:56:56.095 Command-line: "C:\Program Files (x86)\WinSCP\WinSCP.exe" /console=5.19.6 /consoleinstance=_25988_652 "/log=C:\SftpScripts\Log\WinSCP.log" "/ini=nul" "/command" "open sftp://THR1:***@12.50.9.55/ -hostkey=""ssh-rsa 1024 h/hAIAyM00g7C85w9sSGKlutqsjrCf/ka8ZxD9hPKZw=""" "cd /sftp.DALE.org/usr/RUSTY/835/Test" "lcd ""E:\Raw Client Data Files\THR\Automated Pull Down - Not Processed\835""" "get -delete /sftp.DALE.org/usr/RUSTY/835/Test/*" "exit"
. 2022-05-20 17:56:56.095 Time zone: Current: GMT+0 (Coordinated Universal Time), No DST

The data/lines I would like to pull from the log would say something like:

 2022-05-25 20:58:26.195 File: '/sftp.DALE.org/usr/RUSTY/835/From_THR/Send to Rusty Mar 2022 Whole and JV Epic only/TEST_68069NON2022033111220600X_MCDMCD' [2022-05-24T20:24:18.000Z] [1432]

. 2022-05-25 20:58:26.196 Copying "/sftp.DALE.org/usr/RUSTY/835/From_THR/Send to Rusty Mar 2022 Whole and JV Epic only/TEST_68069NON2022033111220600X_MCDMCD" to local directory started.

Which I believe provides an example of a file copied successfully to the correct folder. Hopefully, this provides more insight.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情感失落者 2025-02-08 10:31:52

首先,我不明白为什么grep(或@stephan建议的Findstr)对您不起作用。

无论如何,您会获得最大的灵活性, xml记录。使用 /xmllog command> command> command> commandline switch。 XML日志比会话日志的详细信息少,但它包含有关转移的所有信息,并且可以转换为您喜欢的任何格式

First, I do not see why grep (or findstr as suggested by @Stephan) won't work for you.

Anyway, you get the greatest flexibility with XML logging. Use /xmllog command-line switch. XML log is way less verbose than the session log, yet it includes all information about transfers, and it can be transformed to any format you like.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文