How to output file sizes in human-readable format in an rsync logfile

I know that the -h option outputs file sizes in human-readable format when, for example, displaying the transfer progress with --progress.

But is it possible to get this same file size formatting in the log files? I see options/escapes to display the number of bytes being transferred (%b) and also the total size of the file (%l), but don't see any way to output more human-readable equivalents for these values.

1 Answer

Found this here rsyncd.conf -- configuration file for rsync in daemon mode ...

 log format This parameter allows you to specify the format used for logging file transfers when transfer logging is enabled. The format is a text string containing embedded single-character escape sequences prefixed with a percent (%) character. An optional numeric field width may also be specified between the percent and the escape letter (e.g. "%-50n %8l %07p"). In addition, one or more apostrophes may be specified prior to a numerical escape to indicate that the numerical value should be made more human-readable. The 3 supported levels are the same as for the --human-readable command-line option, though the default is for human- readability to be off. Each added apostrophe increases the level (e.g. "%''l %'b %f"). 

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like