According to the rsync manpage, the --out-format <FORMAT> switch supports the single character escapes listed under the 'log format' options in rsyncd.conf manpage, however for my version of rsync some of the escapes don't work.
In this specific case : %a, %h, %P, %u are not expanded.
[tiris@sts-dev tg_sync]$ rsync -tr -v --out-format "%a %b %B %c %f %G %h %i %l %L %m %M %n %o %p %P %t %u %U" rsync://firstname.lastname@example.org/log /cifs/tiris/tg-b1
receiving file list ... done
%a 1089 rw-rw-r-- 0 rsyncd DEFAULT %h >f.st...... 69953 2011/11/01-00:55:24 rsyncd recv 10013 %P 2011/11/01 00:55:26 %u 0
%a 2889 rw-rw-r-- 0 tg DEFAULT %h >f.st...... 15377 2011/11/01-00:55:00 tg recv 10013 %P 2011/11/01 00:55:26 %u 0
sent 823 bytes received 4541 bytes 975.27 bytes/sec
total size is 680044 speedup is 126.78
$ rsync --version
rsync version 3.0.6 protocol version 30
Copyright (C) 1996-2009 by Andrew Tridgell, Wayne Davison, and others.
Web site: http://rsync.samba.org/
64-bit files, 64-bit inums, 32-bit timestamps, 64-bit long ints,
socketpairs, hardlinks, symlinks, IPv6, batchfiles, inplace,
append, ACLs, xattrs, iconv, symtimes
This is how rsync displays a value that is null (undefined) -- it displays the escape that is not defined. In all the escapes you cited, they are you defined in a daemon, so the non-daemon side has no data to output for them. If you use them in the daemon's output, they would display the expected information.
So, is the current practice the right one? I want rsync to display something for an undefined field, since displaying nothing at all can make the parsing of the columns not match up right. We could have it display "(null)" or "<empty>" or some such value, which might be better.
My expectation was that for the non-daemon rsync, the %a and %h would indicate the remote IP (if one) was being used, which was useful in the situation where I am performing a pull rsync with a non-daemon rsync from many remote systems (running the daemon) to one local repository. currently I'm having to emit the host name in the bash script that rsync is working with.
rsync -tr -v --out-format rsync://user@$HOST/log <dest>
It's not a biggie.. I just thought the %a and %h in the --out-format could do that automatically for me.
I'm not sure what might be work emitting if the value is empty.. besides perhaps making the distinction in the manpages a bit clearer as to which is supported in daemon and non-daemon.