# %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 # all logs: # gzip -9 %/.*/% # NOTE: %n still expands to the full name of the log, not whatever matches # we'll do the monthly entries first, since they probably get fewer # hits and can afford to sit before a restart /var/log/httpd-local/feltesgroup.com { access monthly %y%m.%n /mnt/Logs/WWW/feltesgroup.com error monthly %y%m.%n /mnt/Logs/WWW/feltesgroup.com } /var/log/httpd-local/mhonarc.org { access monthly %y%m.%n /mnt/Logs/WWW/mhonarc.org error monthly %y%m.%n /mnt/Logs/WWW/mhonarc.org } /var/log/httpd-local/hort.net { access monthly %y%m.%n /mnt/Logs/WWW/hort.net error monthly %y%m.%n /mnt/Logs/WWW/hort.net } /var/log/httpd-local/devilstick.org { access monthly %y%m.%n /mnt/Logs/WWW/devilstick.org error monthly %y%m.%n /mnt/Logs/WWW/devilstick.org } /var/log/httpd-local/hellebores.hort.net { access monthly %y%m.%n /mnt/Logs/WWW/hellebores.hort.net error monthly %y%m.%n /mnt/Logs/WWW/hellebores.hort.net } /var/log/httpd-local/munchkinnursery.com { access monthly %y%m.%n /mnt/Logs/WWW/munchkinnursery.com error monthly %y%m.%n /mnt/Logs/WWW/munchkinnursery.com } # ---------------------------------------------------------------------- # Now we'll do the dailies, with the most frequent last /var/log/httpd-local/bftopics.org { access daily %d%b%y.%n /mnt/Logs/WWW/bftopics.org/%y%m error monthly %y%m.%n /mnt/Logs/WWW/bftopics.org } /var/log/httpd-local/heronswood.com { access daily %d%b%y.%n /mnt/Logs/WWW/heronswood.com/%y%m error monthly %y%m.%n /mnt/Logs/WWW/heronswood.com/%y%m } /var/log/httpd-local/mallorn { access daily %d%b%y.%n /mnt/Logs/WWW/mallorn.com/%y%m error monthly %y%m.%n /mnt/Logs/WWW/mallorn.com/%y%m } /var/log/httpd-local/lalecheleague.org { access daily %d%b%y.%n /mnt/Logs/WWW/lalecheleague.org/%y%m error monthly %y%m.%n /mnt/Logs/WWW/lalecheleague.org/%y%m } # move *ALL* logs in /mnt/Logs/majordomo /mnt/Logs/majordomo { majorlog.* monthly %d%b%y.%n /mnt/Logs/majordomo/lists/%y%m } ACTION { /etc/rc.d/init.d/httpd restart # compress all log files moved this time through gzip -9 %/.*/% } /var/log/httpd/secure/mallorn.com { access monthly %y%m.%n /mnt/Logs/WWW/secure/mallorn.com/%y%m error monthly %y%m.%n /mnt/Logs/WWW/secure/mallorn.com/%y%m cipher monthly %y%m.%n /mnt/Logs/WWW/secure/mallorn.com/%y%m } ACTION { # compress all old data files in /mnt/Logs/majordomo/archives /usr/bin/find /mnt/Logs/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 {} \; # restart httpsd /etc/rc.d/init.d/httpsd restart mail -s "httpsd restarted" sysadmin < /dev/null }