2 # Filter the rsync daemon log messages by module name. The log file can be
3 # in either syslog format or rsync's own log-file format. Note that the
4 # MODULE_NAME parameter is used in a regular-expression match in order to
5 # allow regex wildcards to be used. You can also limit the output by
6 # directory hierarchy in a module. Examples:
8 # logfilter foo /var/log/rsyncd.log # output lines for module foo
9 # logfilter foo/dir /var/log/syslog # limit lines to those in dir of foo
14 die "Usage: logfilter MODULE_NAME [LOGFILE ...]\n" unless defined $match;
16 my $syslog_prefix = '\w\w\w +\d+ \d\d:\d\d:\d\d \S+ rsyncd';
17 my $rsyncd_prefix = '\d\d\d\d/\d\d/\d\d \d\d:\d\d:\d\d ';
22 my($pid,$msg) = /^(?:$syslog_prefix|$rsyncd_prefix)\[(\d+)\]:? (.*)/o;
23 next unless defined $pid;
24 my($mod_spec) = $msg =~ /^rsync (?:on|to) (\S+) from /;
25 if (defined $mod_spec) {
26 if ($mod_spec =~ /^$match(\/\S
*)?
$/o
) {
32 next unless $pids{$pid};