# %a = lowercase abbreviated weekday name (sun..sat) # %A = full weekday name, variable length (Sunday..Saturday) # %d = day of the month (01..31) # %e = day of the month, blank padded (1.31) # %B = full month name, variable length (January..December) # %b = lowercase three-letter representation of month (jan..dec) # %h = same as %b # %m = 2-digit representation of month (01..12) # %w = day of week (0..6); 0 = Sunday # %y = 2-digit representation of year (00..99) # %Y = 4-digit representation of year (1970...) # %n = logname from column 1 # %s = text after last slash in directory naming log location # col1 = log filename (regular expressions OK) # col2 = frequency of rotation (daily, monthly) # col3 = output filename # col4 = output directory # an associative array is built as the file is parsed, FOR EACH ENTRY # $log{$col1}[n] = final log directory+filename # # i.e. # /var/log/httpd/example.com { # access daily %d%b%y.%n /mnt/Logs/WWW/%s/%y%m%d # error monthly %y%m.%n /mnt/Logs/WWW/%s/%y%m # } # results in # $log{"access"}[0] = "/mnt/Logs/WWW/example.com/%y%m%d/%d%b%y.%n"; # $log{"error"}[0] = "/mnt/Logs/WWW/example.com/%y%m/%y%m.%n"; # # This can be used in an action line: # gzip -9 %/access/% # would then gzip all access logs that have been successfully processed up # to that point. Can also use any other regular expressions. i.e. match # and gzip all logs: # gzip -9 %/.*/% # NOTE: %n still expands to the full name of the log, not as part of the regex /etc/mail/spam { spam-archive daily %d%b%y.%n /etc/mail/spam/%y%m } /etc/mail/majordomo/logs { majorlog.* monthly %d%b%y.%n /etc/mail/majordomo/lists/%y%m } /etc/mail/majordomo/archives { majordomo.archive monthly %n-%y%m /etc/mail/majordomo } # move *ALL* logs in /mnt/Logs/majordomo /mnt/Logs/majordomo { majorlog.* monthly %d%b%y.%n /mnt/Logs/majordomo/lists/%y%m } ACTION { # compress all old data files in /mnt/Logs/majordomo/archives /usr/bin/find /etc/mail/majordomo/archives -mtime +1 -name '[0-9][0-9][a-z][a-z][a-z][0-9][0-9]' -type f -daystart ! -mtime -1 -exec /usr/local/bin/bzip2 -9 {} \; # compress all old data files in /etc/mail/mailimage /usr/bin/find /etc/mail/mailimage -mtime +1 -name '[0-9][0-9][a-z][a-z][a-z][0-9][0-9]' -type f -daystart ! -mtime -1 -maxdepth 1 -exec /usr/local/bin/bzip2 -9 {} \; # compress all log files moved this time through /usr/local/bin/bzip2 -9s %/.*/% }