# %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
# 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

/mnt/Admin/backups/SQL {
   update.log     daily      %d%b%y.%n   /mnt/Admin/backups/SQL/updates/%y%m
}

ACTION {
   # dump databases
   /usr/local/scripts/backupdb

   # compress all update log files moved this time through
   /usr/local/bin/bzip2 -9s %/.*/%

   # remove old binary logs
   /usr/bin/find /mnt/SQL/SQL-backups/binlog -mtime +30 -exec rm -f {} \;
}