rsync log file question

Wayne Davison wayned at samba.org
Mon Mar 13 16:46:38 GMT 2006


On Sun, Mar 12, 2006 at 09:59:52PM -0500, Doug Lochart wrote:
> Is there a utility out there that will handle the server/client log files
> even if you chaneg the format around?

You just need to customize the matching code in the rsyncstats script.
It ships with support for two log formats (both with the normal implied
"%t [%p]" prefix):

    %o %h [%a] %m (%u) %f %l
    %i %h [%a] %m (%u) %f %l

Note that this currently only parses log files that rsync generated
(i.e. not output by syslog) due to the date matching:

    next unless ($day,$time,$op,$host,$module,$file,$bytes)
      = m#^ (\d+/\d\d/\d\d)\s+(\d\d:\d\d:\d\d)\s+\[\d+\]\s+(send|recv|[<>]f\S+)\s+
          (\S+)\s+\[\d+\.\d+\.\d+\.\d+\]\s+(\S+)\s+\(\S*\)\s+(.*)\s+(\d+) $ #x;

Here's an improved version that allows it to match syslog entries, and
makes the regex a little clearer:

   next unless ($day,$time,$op,$host,$module,$file,$bytes)
      = m{^
	  ( \w\w\w\s+\d+ | \d+/\d\d/\d\d ) \s+ # day
	  (\d\d:\d\d:\d\d) \s+                 # time
	  [^[]* \[\d+\]:? \s+                  # pid (ignored)
	  (send|recv|[<>]f\S+) \s+             # op (%o or %i)
	  (\S+) \s+                            # host
	  \[\d+\.\d+\.\d+\.\d+\] \s+           # IP (ignored)
	  (\S+) \s+                            # module
	  \(\S*\) \s+                          # user (ignored)
	  (.*) \s+                             # file name
	  (\d+)                                # file length in bytes
	  $ }x;

If you need help modifying that, let me know what "log format" you use.

..wayne..


More information about the rsync mailing list