logging_xml » Revisions »
Differences
This shows you the differences between the selected revisions of the page.
2022-06-16 | 2024-10-03 | ||
5.21 stable released (martin) | 1 (196.247.224.141) (hidden) (untrusted) | ||
Line 1: | Line 1: | ||
+ | 317 | ||
+ | |||
+ | |||
====== XML Logging ====== | ====== XML Logging ====== | ||
XML logging is one of the WinSCP [[logging|log formats]]. An %%XML%% log includes structured records describing operations done by WinSCP over session. The log format is protocol independent. | XML logging is one of the WinSCP [[logging|log formats]]. An %%XML%% log includes structured records describing operations done by WinSCP over session. The log format is protocol independent. | ||
Line 19: | Line 22: | ||
An overall format of the %%XML%% log file follows: | An overall format of the %%XML%% log file follows: | ||
- | <code xml> | + | &lt;code xml&gt; |
- | <?xml version="1.0" encoding="UTF-8"?> | + | &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt; |
- | <session xmlns="http://winscp.net/schema/session/1.0" | + | &lt;session xmlns=&quot;http://winscp.net/schema/session/1.0&quot; |
- | name="martin@example.com" start="2009-03-02T19:34:57.734Z"> | + | name=&quot;martin@example.com&quot; start=&quot;2009-03-02T19:34:57.734Z&quot;&gt; |
- | <!-- operations --> | + | &lt;!-- operations --&gt; |
- | </session> | + | &lt;/session&gt; |
- | </code> | + | &lt;/code&gt; |
- | The top level ''session'' tag represents one logical session, which may consist of several physical sessions, particularly when connection is lost. Attribute ''name'' refers to name of the logical session. Attribute ''start'' indicates time when the session was initiated.((All timestamps in the %%XML%% log have %%XML%% ''dateTime'' type, where only ''%%YYYY-MM-DD"T"HH:MM:SS.NNN"Z"%%'' syntax is used.)) | + | The top level ''session'' tag represents one logical session, which may consist of several physical sessions, particularly when connection is lost. Attribute ''name'' refers to name of the logical session. Attribute ''start'' indicates time when the session was initiated.((All timestamps in the %%XML%% log have %%XML%% ''dateTime'' type, where only ''%%YYYY-MM-DD&quot;T&quot;HH:MM:SS.NNN&quot;Z&quot;%%'' syntax is used.)) |
The ''session'' element includes [[#elements|child elements]], where each element represents single log entry, i.e. single physical operation with remote file over the logical session. | The ''session'' element includes [[#elements|child elements]], where each element represents single log entry, i.e. single physical operation with remote file over the logical session. | ||
Line 43: | Line 46: | ||
Result of a specific operation is represented by child ''result'' element of respective operation element. The ''result'' element has boolean ''success'' attribute. | Result of a specific operation is represented by child ''result'' element of respective operation element. The ''result'' element has boolean ''success'' attribute. | ||
- | <code xml> | + | &lt;code xml&gt; |
- | <result success="true" /> | + | &lt;result success=&quot;true&quot; /&gt; |
- | </code> | + | &lt;/code&gt; |
If ''success'' is ''false'', ''result'' element will typically include one or more ''message'' elements with error message(s). The error message is free text, that may be language-, protocol- or even server-specific. So you should not try to process it automatically. | If ''success'' is ''false'', ''result'' element will typically include one or more ''message'' elements with error message(s). The error message is free text, that may be language-, protocol- or even server-specific. So you should not try to process it automatically. | ||
The following example is from English version, connected with SFTP protocol to OpenSSH server: | The following example is from English version, connected with SFTP protocol to OpenSSH server: | ||
- | <code xml> | + | &lt;code xml&gt; |
- | <result success="false"> | + | &lt;result success=&quot;false&quot;&gt; |
- | <message>Cannot open remote file '/home/user/examplefile.txt'.</message> | + | &lt;message&gt;Cannot open remote file '/home/user/examplefile.txt'.&lt;/message&gt; |
- | <message>No such file or directory. | + | &lt;message&gt;No such file or directory. |
Error code: 2 | Error code: 2 | ||
Error message from server: No such file | Error message from server: No such file | ||
- | Request code: 3</message> | + | Request code: 3&lt;/message&gt; |
- | </result> | + | &lt;/result&gt; |
- | </code> | + | &lt;/code&gt; |
With some protocols, each of the physical operations are performed individually. With some protocols, set of operations may be performed in atomic form. This may prevent mapping error to specific operation. In this case the error may be associated with more operations, resulting in its duplication in the %%XML%% log. | With some protocols, each of the physical operations are performed individually. With some protocols, set of operations may be performed in atomic form. This may prevent mapping error to specific operation. In this case the error may be associated with more operations, resulting in its duplication in the %%XML%% log. | ||
Line 71: | Line 74: | ||
If the particular error was associated with a physical operation, the error message will be included both in ''result'' child element of the respective operation element and in ''failure'' child element of top level ''session'' element or ''group'' element. | If the particular error was associated with a physical operation, the error message will be included both in ''result'' child element of the respective operation element and in ''failure'' child element of top level ''session'' element or ''group'' element. | ||
- | <code xml> | + | &lt;code xml&gt; |
- | <upload> | + | &lt;upload&gt; |
- | <filename value="d:\examplefile.txt" /> | + | &lt;filename value=&quot;d:\examplefile.txt&quot; /&gt; |
- | <result success="false"> | + | &lt;result success=&quot;false&quot;&gt; |
- | <message>Cannot create remote file '/home/user/examplefile.txt'.</message> | + | &lt;message&gt;Cannot create remote file '/home/user/examplefile.txt'.&lt;/message&gt; |
- | <message>Permission denied. | + | &lt;message&gt;Permission denied. |
Error code: 3 | Error code: 3 | ||
Error message from server: Permission denied | Error message from server: Permission denied | ||
- | Request code: 3</message> | + | Request code: 3&lt;/message&gt; |
- | </result> | + | &lt;/result&gt; |
- | </upload> | + | &lt;/upload&gt; |
- | <failure> | + | &lt;failure&gt; |
- | <message>Cannot create remote file '/home/user/examplefile.txt'.</message> | + | &lt;message&gt;Cannot create remote file '/home/user/examplefile.txt'.&lt;/message&gt; |
- | <message>Permission denied. | + | &lt;message&gt;Permission denied. |
Error code: 3 | Error code: 3 | ||
Error message from server: Permission denied | Error message from server: Permission denied | ||
- | Request code: 3</message> | + | Request code: 3&lt;/message&gt; |
- | </failure> | + | &lt;/failure&gt; |
- | </code> | + | &lt;/code&gt; |
===== [[group]] Grouping Operations for Commands ===== | ===== [[group]] Grouping Operations for Commands ===== | ||
When using the %%XML%% logging together with [[scripting|scripting]], [[#elements|operations]] and [[#result_script|failures]] belonging to the same command can be grouped using parent ''group'' element: | When using the %%XML%% logging together with [[scripting|scripting]], [[#elements|operations]] and [[#result_script|failures]] belonging to the same command can be grouped using parent ''group'' element: | ||
- | <code xml> | + | &lt;code xml&gt; |
- | <group name="put -preservetime d:\*.txt" start="2021-12-03T14:25:10.204Z"> | + | &lt;group name=&quot;put -preservetime d:\*.txt&quot; start=&quot;2021-12-03T14:25:10.204Z&quot;&gt; |
- | <upload> | + | &lt;upload&gt; |
- | <filename value="d:\readme.txt" /> | + | &lt;filename value=&quot;d:\readme.txt&quot; /&gt; |
- | <destination value="/home/user/readme.txt" /> | + | &lt;destination value=&quot;/home/user/readme.txt&quot; /&gt; |
- | <size value="15345" /> | + | &lt;size value=&quot;15345&quot; /&gt; |
- | <result success="true" /> | + | &lt;result success=&quot;true&quot; /&gt; |
- | </upload> | + | &lt;/upload&gt; |
- | <upload> | + | &lt;upload&gt; |
- | <filename value="d:\examplefile.txt" /> | + | &lt;filename value=&quot;d:\examplefile.txt&quot; /&gt; |
- | <result success="false"> | + | &lt;result success=&quot;false&quot;&gt; |
- | <message>Cannot create remote file '/home/user/examplefile.txt'.</message> | + | &lt;message&gt;Cannot create remote file '/home/user/examplefile.txt'.&lt;/message&gt; |
- | <message>Permission denied. | + | &lt;message&gt;Permission denied. |
Error code: 3 | Error code: 3 | ||
Error message from server: Permission denied | Error message from server: Permission denied | ||
- | Request code: 3</message> | + | Request code: 3&lt;/message&gt; |
- | </result> | + | &lt;/result&gt; |
- | </upload> | + | &lt;/upload&gt; |
- | <failure> | + | &lt;failure&gt; |
- | <message>Cannot create remote file '/home/user/examplefile.txt'.</message> | + | &lt;message&gt;Cannot create remote file '/home/user/examplefile.txt'.&lt;/message&gt; |
- | <message>Permission denied. | + | &lt;message&gt;Permission denied. |
Error code: 3 | Error code: 3 | ||
Error message from server: Permission denied | Error message from server: Permission denied | ||
- | Request code: 3</message> | + | Request code: 3&lt;/message&gt; |
- | </failure> | + | &lt;/failure&gt; |
- | </group> | + | &lt;/group&gt; |
- | </code> | + | &lt;/code&gt; |
Grouping can be enabled on [[commandline#scripting|command-line]]. | Grouping can be enabled on [[commandline#scripting|command-line]]. | ||
- | //Grouping is particularly useful, when you are [[guide_interpreting_xml_log#continuous|continuously reading the XML log file]]. By receiving ''</group>'' you know that the command execution has finished.// | + | //Grouping is particularly useful, when you are [[guide_interpreting_xml_log#continuous|continuously reading the XML log file]]. By receiving ''&lt;/group&gt;'' you know that the command execution has finished.// |
===== [[elements]] Elements ===== | ===== [[elements]] Elements ===== | ||
Line 142: | Line 145: | ||
Example: | Example: | ||
- | <code xml> | + | &lt;code xml&gt; |
- | <call> | + | &lt;call&gt; |
- | <command value="ps" /> | + | &lt;command value=&quot;ps&quot; /&gt; |
- | <destination value="/home/user" /> | + | &lt;destination value=&quot;/home/user&quot; /&gt; |
- | <output value=" PID TTY TIME CMD | + | &lt;output value=&quot; PID TTY TIME CMD |
16969 ? 00:00:00 sshd | 16969 ? 00:00:00 sshd | ||
16970 ? 00:00:00 sftp-server | 16970 ? 00:00:00 sftp-server | ||
32647 ? 00:00:00 bash | 32647 ? 00:00:00 bash | ||
- | 1466 ? 00:00:00 ps" /> | + | 1466 ? 00:00:00 ps&quot; /&gt; |
- | <result success="true" /> | + | &lt;result success=&quot;true&quot; /&gt; |
- | </call> | + | &lt;/call&gt; |
- | </code> | + | &lt;/code&gt; |
Associated script commands: ''[[scriptcommand_call|call]]'' | Associated script commands: ''[[scriptcommand_call|call]]'' | ||
Line 167: | Line 170: | ||
Example: | Example: | ||
- | <code xml> | + | &lt;code xml&gt; |
- | <checksum> | + | &lt;checksum&gt; |
- | <filename value="/home/martin/public_html/index.html" /> | + | &lt;filename value=&quot;/home/martin/public_html/index.html&quot; /&gt; |
- | <algorithm value="sha-1" /> | + | &lt;algorithm value=&quot;sha-1&quot; /&gt; |
- | <checksum value="bb4dfa9b51d3f6c99b5ec6c12ebf9cade79f43c4" /> | + | &lt;checksum value=&quot;bb4dfa9b51d3f6c99b5ec6c12ebf9cade79f43c4&quot; /&gt; |
- | <result success="true" /> | + | &lt;result success=&quot;true&quot; /&gt; |
- | </checksum> | + | &lt;/checksum&gt; |
- | </code> | + | &lt;/code&gt; |
Associated script commands: ''[[scriptcommand_checksum|checksum]]'' | Associated script commands: ''[[scriptcommand_checksum|checksum]]'' | ||
Line 189: | Line 192: | ||
Example: | Example: | ||
- | <code xml> | + | &lt;code xml&gt; |
- | <chmod recursive="true"> | + | &lt;chmod recursive=&quot;true&quot;&gt; |
- | <filename value="/home/martin/public_html/about.html" /> | + | &lt;filename value=&quot;/home/martin/public_html/about.html&quot; /&gt; |
- | <permissions value="rwxr-xr-x" /> | + | &lt;permissions value=&quot;rwxr-xr-x&quot; /&gt; |
- | <result success="true" /> | + | &lt;result success=&quot;true&quot; /&gt; |
- | </chmod> | + | &lt;/chmod&gt; |
- | </code> | + | &lt;/code&gt; |
Associated script commands: ''[[scriptcommand_chmod|chmod]]'', ''[[scriptcommand_keepuptodate|keepuptodate]] -permissions'', ''[[scriptcommand_put|put]] -permissions'', ''[[scriptcommand_synchronize|synchronize]] remote|both -permissions'' | Associated script commands: ''[[scriptcommand_chmod|chmod]]'', ''[[scriptcommand_keepuptodate|keepuptodate]] -permissions'', ''[[scriptcommand_put|put]] -permissions'', ''[[scriptcommand_synchronize|synchronize]] remote|both -permissions'' | ||
Line 208: | Line 211: | ||
Example: | Example: | ||
- | <code xml> | + | &lt;code xml&gt; |
- | <cp> | + | &lt;cp&gt; |
- | <filename value="/home/martin/public_html/about.html" /> | + | &lt;filename value=&quot;/home/martin/public_html/about.html&quot; /&gt; |
- | <destination value="/home/martin/backup/about.html.20171220" /> | + | &lt;destination value=&quot;/home/martin/backup/about.html.20171220&quot; /&gt; |
- | <result success="true" /> | + | &lt;result success=&quot;true&quot; /&gt; |
- | </cp> | + | &lt;/cp&gt; |
- | </code> | + | &lt;/code&gt; |
Associated script commands: ''[[scriptcommand_cp|cp]]'' | Associated script commands: ''[[scriptcommand_cp|cp]]'' | ||
Line 228: | Line 231: | ||
Example: | Example: | ||
- | <code xml> | + | &lt;code xml&gt; |
- | <download> | + | &lt;download&gt; |
- | <filename value="/home/martin/public_html/about.html" /> | + | &lt;filename value=&quot;/home/martin/public_html/about.html&quot; /&gt; |
- | <destination value="d:\www\about.htm" /> | + | &lt;destination value=&quot;d:\www\about.htm&quot; /&gt; |
- | <size value="55387" /> | + | &lt;size value=&quot;55387&quot; /&gt; |
- | <result success="true" /> | + | &lt;result success=&quot;true&quot; /&gt; |
- | </download> | + | &lt;/download&gt; |
- | </code> | + | &lt;/code&gt; |
Associated script commands: ''[[scriptcommand_get|get]]'', ''[[scriptcommand_synchronize|synchronize]] local|both'' | Associated script commands: ''[[scriptcommand_get|get]]'', ''[[scriptcommand_synchronize|synchronize]] local|both'' | ||
Line 252: | Line 255: | ||
| ''type'' | Type of file as in Unix ''ls'' command output, e.g. ''d'' for directory (in ''value'' attribute) | | | ''type'' | Type of file as in Unix ''ls'' command output, e.g. ''d'' for directory (in ''value'' attribute) | | ||
| ''size'' | Size of file in bytes (in ''value'' attribute) | | | ''size'' | Size of file in bytes (in ''value'' attribute) | | ||
- | | ''modification'' | Modification timestamp (in ''value'' attribute)((All timestamps in the %%XML%% log have %%XML%% ''dateTime'' type, where only ''%%YYYY-MM-DD"T"HH:MM:SS.NNN"Z"%%'' syntax is used.)) | | + | | ''modification'' | Modification timestamp (in ''value'' attribute)((All timestamps in the %%XML%% log have %%XML%% ''dateTime'' type, where only ''%%YYYY-MM-DD&quot;T&quot;HH:MM:SS.NNN&quot;Z&quot;%%'' syntax is used.)) | |
| ''permissions'' | File permissions in Unix format ''rwxrwxrwx'' (in ''value'' attribute) | | | ''permissions'' | File permissions in Unix format ''rwxrwxrwx'' (in ''value'' attribute) | | ||
| ''owner'' | File owner (in ''value'' attribute) | | | ''owner'' | File owner (in ''value'' attribute) | | ||
Line 258: | Line 261: | ||
Example: | Example: | ||
- | <code xml> | + | &lt;code xml&gt; |
- | <ls> | + | &lt;ls&gt; |
- | <destination value="/home/martin/public_html" /> | + | &lt;destination value=&quot;/home/martin/public_html&quot; /&gt; |
- | <files> | + | &lt;files&gt; |
- | <file> | + | &lt;file&gt; |
- | <filename value="." /> | + | &lt;filename value=&quot;.&quot; /&gt; |
- | <type value="d" /> | + | &lt;type value=&quot;d&quot; /&gt; |
- | <modification value="2008-12-22T12:16:23.000Z" /> | + | &lt;modification value=&quot;2008-12-22T12:16:23.000Z&quot; /&gt; |
- | <permissions value="rwxr-xr-x" /> | + | &lt;permissions value=&quot;rwxr-xr-x&quot; /&gt; |
- | </file> | + | &lt;/file&gt; |
- | <file> | + | &lt;file&gt; |
- | <filename value=".." /> | + | &lt;filename value=&quot;..&quot; /&gt; |
- | <type value="d" /> | + | &lt;type value=&quot;d&quot; /&gt; |
- | <modification value="2008-03-25T08:15:53.000Z" /> | + | &lt;modification value=&quot;2008-03-25T08:15:53.000Z&quot; /&gt; |
- | <permissions value="rwxr-xr-x" /> | + | &lt;permissions value=&quot;rwxr-xr-x&quot; /&gt; |
- | </file> | + | &lt;/file&gt; |
- | <file> | + | &lt;file&gt; |
- | <filename value=".htaccess" /> | + | &lt;filename value=&quot;.htaccess&quot; /&gt; |
- | <type value="-" /> | + | &lt;type value=&quot;-&quot; /&gt; |
- | <size value="107" /> | + | &lt;size value=&quot;107&quot; /&gt; |
- | <modification value="2008-12-02T06:59:58.000Z" /> | + | &lt;modification value=&quot;2008-12-02T06:59:58.000Z&quot; /&gt; |
- | <permissions value="rw-r--r--" /> | + | &lt;permissions value=&quot;rw-r--r--&quot; /&gt; |
- | </file> | + | &lt;/file&gt; |
- | <file> | + | &lt;file&gt; |
- | <filename value="about.html" /> | + | &lt;filename value=&quot;about.html&quot; /&gt; |
- | <type value="-" /> | + | &lt;type value=&quot;-&quot; /&gt; |
- | <size value="24064" /> | + | &lt;size value=&quot;24064&quot; /&gt; |
- | <modification value="2007-10-04T21:43:02.000Z" /> | + | &lt;modification value=&quot;2007-10-04T21:43:02.000Z&quot; /&gt; |
- | <permissions value="rw-r--r--" /> | + | &lt;permissions value=&quot;rw-r--r--&quot; /&gt; |
- | </file> | + | &lt;/file&gt; |
- | </files> | + | &lt;/files&gt; |
- | <result success="true" /> | + | &lt;result success=&quot;true&quot; /&gt; |
- | </ls> | + | &lt;/ls&gt; |
- | </code> | + | &lt;/code&gt; |
Associated script commands: ''[[scriptcommand_ls|ls]]'' | Associated script commands: ''[[scriptcommand_ls|ls]]'' | ||
Line 303: | Line 306: | ||
Example: | Example: | ||
- | <code xml> | + | &lt;code xml&gt; |
- | <mkdir> | + | &lt;mkdir&gt; |
- | <filename value="/home/martin/public_html/images" /> | + | &lt;filename value=&quot;/home/martin/public_html/images&quot; /&gt; |
- | <result success="true" /> | + | &lt;result success=&quot;true&quot; /&gt; |
- | </mkdir> | + | &lt;/mkdir&gt; |
- | </code> | + | &lt;/code&gt; |
Associated script commands: ''[[scriptcommand_keepuptodate|keepuptodate]]'', ''[[scriptcommand_mkdir|mkdir]]'', ''[[scriptcommand_put|put]]'', ''[[scriptcommand_synchronize|synchronize]] remote|both'' | Associated script commands: ''[[scriptcommand_keepuptodate|keepuptodate]]'', ''[[scriptcommand_mkdir|mkdir]]'', ''[[scriptcommand_put|put]]'', ''[[scriptcommand_synchronize|synchronize]] remote|both'' | ||
Line 321: | Line 324: | ||
Example: | Example: | ||
- | <code xml> | + | &lt;code xml&gt; |
- | <mv> | + | &lt;mv&gt; |
- | <filename value="/home/martin/public_html/about.html" /> | + | &lt;filename value=&quot;/home/martin/public_html/about.html&quot; /&gt; |
- | <destination value="/tmp/about.bak" /> | + | &lt;destination value=&quot;/tmp/about.bak&quot; /&gt; |
- | <result success="true" /> | + | &lt;result success=&quot;true&quot; /&gt; |
- | </mv> | + | &lt;/mv&gt; |
- | </code> | + | &lt;/code&gt; |
Associated script commands: ''[[scriptcommand_mv|mv]]'' | Associated script commands: ''[[scriptcommand_mv|mv]]'' | ||
Line 341: | Line 344: | ||
Example: | Example: | ||
- | <code xml> | + | &lt;code xml&gt; |
- | <rm recursive="true"> | + | &lt;rm recursive=&quot;true&quot;&gt; |
- | <filename value="/home/martin/public_html/images" /> | + | &lt;filename value=&quot;/home/martin/public_html/images&quot; /&gt; |
- | <result success="true" /> | + | &lt;result success=&quot;true&quot; /&gt; |
- | </rm> | + | &lt;/rm&gt; |
- | </code> | + | &lt;/code&gt; |
Associated script commands: ''[[scriptcommand_get|get]] -delete'', ''[[scriptcommand_keepuptodate|keepuptodate]] -delete'', ''[[scriptcommand_rm|rm]]'', ''[[scriptcommand_rmdir|rmdir]]'', ''[[scriptcommand_synchronize|synchronize]] local|both -delete'' | Associated script commands: ''[[scriptcommand_get|get]] -delete'', ''[[scriptcommand_keepuptodate|keepuptodate]] -delete'', ''[[scriptcommand_rm|rm]]'', ''[[scriptcommand_rmdir|rmdir]]'', ''[[scriptcommand_synchronize|synchronize]] local|both -delete'' | ||
Line 359: | Line 362: | ||
Example: | Example: | ||
- | <code xml> | + | &lt;code xml&gt; |
- | <stat> | + | &lt;stat&gt; |
- | <filename value="/home/martin/public_html/about.html" /> | + | &lt;filename value=&quot;/home/martin/public_html/about.html&quot; /&gt; |
- | <file> | + | &lt;file&gt; |
- | <type value="-" /> | + | &lt;type value=&quot;-&quot; /&gt; |
- | <size value="24064" /> | + | &lt;size value=&quot;24064&quot; /&gt; |
- | <modification value="2007-10-04T21:43:02.000Z" /> | + | &lt;modification value=&quot;2007-10-04T21:43:02.000Z&quot; /&gt; |
- | <permissions value="rw-r--r--" /> | + | &lt;permissions value=&quot;rw-r--r--&quot; /&gt; |
- | </file> | + | &lt;/file&gt; |
- | <result success="true" /> | + | &lt;result success=&quot;true&quot; /&gt; |
- | </stat> | + | &lt;/stat&gt; |
- | </code> | + | &lt;/code&gt; |
Associated script commands: ''[[scriptcommand_stat|stat]]'' | Associated script commands: ''[[scriptcommand_stat|stat]]'' | ||
Line 384: | Line 387: | ||
Example: | Example: | ||
- | <code xml> | + | &lt;code xml&gt; |
- | <upload> | + | &lt;upload&gt; |
- | <filename value="d:\www\about.htm" /> | + | &lt;filename value=&quot;d:\www\about.htm&quot; /&gt; |
- | <destination value="/home/martin/public_html/about.html" /> | + | &lt;destination value=&quot;/home/martin/public_html/about.html&quot; /&gt; |
- | <size value="55387" /> | + | &lt;size value=&quot;55387&quot; /&gt; |
- | <result success="true" /> | + | &lt;result success=&quot;true&quot; /&gt; |
- | </upload> | + | &lt;/upload&gt; |
- | </code> | + | &lt;/code&gt; |
Associated script commands: ''[[scriptcommand_keepuptodate|keepuptodate]]'', ''[[scriptcommand_put|put]]'', ''[[scriptcommand_synchronize|synchronize]] remote|both'' | Associated script commands: ''[[scriptcommand_keepuptodate|keepuptodate]]'', ''[[scriptcommand_put|put]]'', ''[[scriptcommand_synchronize|synchronize]] remote|both'' | ||
Line 401: | Line 404: | ||
^ Element ^ Description ^ | ^ Element ^ Description ^ | ||
| ''filename'' | Absolute path to remote file (in ''value'' attribute) | | | ''filename'' | Absolute path to remote file (in ''value'' attribute) | | ||
- | | ''modification'' | Modification timestamp (in ''value'' attribute)((All timestamps in the %%XML%% log have %%XML%% ''dateTime'' type, where only ''%%YYYY-MM-DD"T"HH:MM:SS.NNN"Z"%%'' syntax is used.)) | | + | | ''modification'' | Modification timestamp (in ''value'' attribute)((All timestamps in the %%XML%% log have %%XML%% ''dateTime'' type, where only ''%%YYYY-MM-DD&quot;T&quot;HH:MM:SS.NNN&quot;Z&quot;%%'' syntax is used.)) | |
Example: | Example: | ||
- | <code xml> | + | &lt;code xml&gt; |
- | <touch> | + | &lt;touch&gt; |
- | <filename value="/home/martin/public_html/about.html" /> | + | &lt;filename value=&quot;/home/martin/public_html/about.html&quot; /&gt; |
- | <modification value="2008-12-28T11:22:19.000Z" /> | + | &lt;modification value=&quot;2008-12-28T11:22:19.000Z&quot; /&gt; |
- | <result success="true" /> | + | &lt;result success=&quot;true&quot; /&gt; |
- | </touch> | + | &lt;/touch&gt; |
- | </code> | + | &lt;/code&gt; |
Associated script commands: ''[[scriptcommand_keepuptodate|keepuptodate]]'', ''[[scriptcommand_put|put]] -preservetime'', ''[[scriptcommand_synchronize|synchronize]] remote|both'' | Associated script commands: ''[[scriptcommand_keepuptodate|keepuptodate]]'', ''[[scriptcommand_put|put]] -preservetime'', ''[[scriptcommand_synchronize|synchronize]] remote|both'' | ||
Line 421: | Line 424: | ||
//Note that the ''[[#group|group]]'' elements will be included, if enabled only.// | //Note that the ''[[#group|group]]'' elements will be included, if enabled only.// | ||
- | <code xml> | + | &lt;code xml&gt; |
- | <?xml version="1.0" encoding="UTF-8"?> | + | &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt; |
- | <session xmlns="http://winscp.net/schema/session/1.0" | + | &lt;session xmlns=&quot;http://winscp.net/schema/session/1.0&quot; |
- | name="martin@example.com" start="2012-01-04T14:25:53.173Z"> | + | name=&quot;martin@example.com&quot; start=&quot;2012-01-04T14:25:53.173Z&quot;&gt; |
- | <group name="put -preservetime -permissions=644 d:\www\about.htm" start="2012-01-04T14:28:45.393Z"> | + | &lt;group name=&quot;put -preservetime -permissions=644 d:\www\about.htm&quot; start=&quot;2012-01-04T14:28:45.393Z&quot;&gt; |
- | <upload> | + | &lt;upload&gt; |
- | <filename value="d:\www\about.htm" /> | + | &lt;filename value=&quot;d:\www\about.htm&quot; /&gt; |
- | <destination value="/home/martin/public_html/about.html" /> | + | &lt;destination value=&quot;/home/martin/public_html/about.html&quot; /&gt; |
- | <result success="true" /> | + | &lt;result success=&quot;true&quot; /&gt; |
- | </upload> | + | &lt;/upload&gt; |
- | <touch> | + | &lt;touch&gt; |
- | <filename value="/home/martin/public_html/about.html" /> | + | &lt;filename value=&quot;/home/martin/public_html/about.html&quot; /&gt; |
- | <modification value="2008-12-28T11:22:19.000Z" /> | + | &lt;modification value=&quot;2008-12-28T11:22:19.000Z&quot; /&gt; |
- | <result success="true" /> | + | &lt;result success=&quot;true&quot; /&gt; |
- | </touch> | + | &lt;/touch&gt; |
- | <chmod> | + | &lt;chmod&gt; |
- | <filename value="/home/martin/public_html/about.html" /> | + | &lt;filename value=&quot;/home/martin/public_html/about.html&quot; /&gt; |
- | <permissions value="rw-r--r--" /> | + | &lt;permissions value=&quot;rw-r--r--&quot; /&gt; |
- | <result success="true" /> | + | &lt;result success=&quot;true&quot; /&gt; |
- | </chmod> | + | &lt;/chmod&gt; |
- | </group> | + | &lt;/group&gt; |
- | <group name="rm about.bak" start="2012-01-04T14:28:47.892Z"> | + | &lt;group name=&quot;rm about.bak&quot; start=&quot;2012-01-04T14:28:47.892Z&quot;&gt; |
- | <rm> | + | &lt;rm&gt; |
- | <filename value="/home/martin/public_html/about.bak" /> | + | &lt;filename value=&quot;/home/martin/public_html/about.bak&quot; /&gt; |
- | <result success="false"> | + | &lt;result success=&quot;false&quot;&gt; |
- | <message>No such file or directory. | + | &lt;message&gt;No such file or directory. |
Error code: 2 | Error code: 2 | ||
Error message from server: No such file | Error message from server: No such file | ||
- | Request code: 13</message> | + | Request code: 13&lt;/message&gt; |
- | </result> | + | &lt;/result&gt; |
- | </rm> | + | &lt;/rm&gt; |
- | <failure> | + | &lt;failure&gt; |
- | <message>No such file or directory. | + | &lt;message&gt;No such file or directory. |
Error code: 2 | Error code: 2 | ||
Error message from server: No such file | Error message from server: No such file | ||
- | Request code: 13</message> | + | Request code: 13&lt;/message&gt; |
- | </failure> | + | &lt;/failure&gt; |
- | </group> | + | &lt;/group&gt; |
- | </session> | + | &lt;/session&gt; |
- | </code> | + | &lt;/code&gt; |
===== [[parse]] Interpreting/Parsing ===== | ===== [[parse]] Interpreting/Parsing ===== | ||
Line 479: | Line 482: | ||
For example to generate a plain text list of successfully downloaded files from the following %%XML%% log (''log.xml''): | For example to generate a plain text list of successfully downloaded files from the following %%XML%% log (''log.xml''): | ||
- | <code xml> | + | &lt;code xml&gt; |
- | <?xml version="1.0" encoding="UTF-8"?> | + | &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt; |
- | <session xmlns="http://winscp.net/schema/session/1.0" name="user@host" start="2021-12-03T06:45:57.008Z"> | + | &lt;session xmlns=&quot;http://winscp.net/schema/session/1.0&quot; name=&quot;user@host&quot; start=&quot;2021-12-03T06:45:57.008Z&quot;&gt; |
- | <download> | + | &lt;download&gt; |
- | <filename value="/path/file1.txt" /> | + | &lt;filename value=&quot;/path/file1.txt&quot; /&gt; |
- | <destination value="C:\path\file1.txt" /> | + | &lt;destination value=&quot;C:\path\file1.txt&quot; /&gt; |
- | <size value="2022" /> | + | &lt;size value=&quot;2022&quot; /&gt; |
- | <result success="true" /> | + | &lt;result success=&quot;true&quot; /&gt; |
- | </download> | + | &lt;/download&gt; |
- | <download> | + | &lt;download&gt; |
- | <filename value="/path/file2.txt" /> | + | &lt;filename value=&quot;/path/file2.txt&quot; /&gt; |
- | <destination value="C:\path\file2.txt" /> | + | &lt;destination value=&quot;C:\path\file2.txt&quot; /&gt; |
- | <size value="5782" /> | + | &lt;size value=&quot;5782&quot; /&gt; |
- | <result success="true" /> | + | &lt;result success=&quot;true&quot; /&gt; |
- | </download> | + | &lt;/download&gt; |
- | </session> | + | &lt;/session&gt; |
- | </code> | + | &lt;/code&gt; |
use the following %%XSLT%% (''download.xslt''): | use the following %%XSLT%% (''download.xslt''): | ||
- | <code xml> | + | &lt;code xml&gt; |
- | <?xml version="1.0" encoding="UTF-8"?> | + | &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt; |
- | <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:winscp="http://winscp.net/schema/session/1.0"> | + | &lt;xsl:stylesheet version=&quot;1.0&quot; xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot; xmlns:winscp=&quot;http://winscp.net/schema/session/1.0&quot;&gt; |
- | <xsl:output method="text" encoding="UTF-8"/> | + | &lt;xsl:output method=&quot;text&quot; encoding=&quot;UTF-8&quot;/&gt; |
- | <xsl:strip-space elements="*"/> | + | &lt;xsl:strip-space elements=&quot;*&quot;/&gt; |
- | <xsl:template match='winscp:download[winscp:result[@success="true"]]/winscp:filename'> | + | &lt;xsl:template match='winscp:download[winscp:result[@success=&quot;true&quot;]]/winscp:filename'&gt; |
- | <xsl:value-of select="@value"/> | + | &lt;xsl:value-of select=&quot;@value&quot;/&gt; |
- | <xsl:text>
</xsl:text> | + | &lt;xsl:text&gt;&amp;#xa;&lt;/xsl:text&gt; |
- | </xsl:template> | + | &lt;/xsl:template&gt; |
- | </xsl:stylesheet> | + | &lt;/xsl:stylesheet&gt; |
- | </code> | + | &lt;/code&gt; |
You can execute it using any %%XSLT%% processor: | You can execute it using any %%XSLT%% processor: | ||
- | * Microsoft ''msxsl.exe'' (deprecated, but [[https://web.archive.org/web/20200202112313/https://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=21714|available from Internet Archive]]): \\ <code> | + | * Microsoft ''msxsl.exe'' (deprecated, but [[https://web.archive.org/web/20200202112313/https://www.microsoft.com/en-us/download/details.aspx?displaylang=en&amp;id=21714|available from Internet Archive]]): \\ &lt;code&gt; |
msxsl.exe log.xml download.xslt | msxsl.exe log.xml download.xslt | ||
- | </code> | + | &lt;/code&gt; |
- | * [[http://xmlsoft.org/|Libxml2]] ''xsltproc.exe'': \\ <code> | + | * [[http://xmlsoft.org/|Libxml2]] ''xsltproc.exe'': \\ &lt;code&gt; |
xsltproc.exe download.xslt log.xml | xsltproc.exe download.xslt log.xml | ||
- | </code> | + | &lt;/code&gt; |
The output will be: | The output will be: | ||
- | <code> | + | &lt;code&gt; |
/path/file1.txt | /path/file1.txt | ||
/path/file2.txt | /path/file2.txt | ||
- | </code> | + | &lt;/code&gt; |
For a more complex example, see [[script_custom_listing_format_csv#scripting|*]]. | For a more complex example, see [[script_custom_listing_format_csv#scripting|*]]. | ||
+ | |||
+ | 1 |