Rot[t]Log
archive, rotates, compresses, and mails system logs.

This is a replacement to Red Hat's logrotate. It have similar
syntax, but more powerful features to cut and store logs. 
In this README there are many parts taken from man page of logrotate.
It's all written in BASH (2.x compatible).

This script require GNU fileutils and GNU grep.

Main configuration file	  : /etc/rottlog/rc
Other configuration files : /etc/rottlog/[daily|weekly|monthly]

rottlog first read main configuration file, then read (in given order)
daily, weekly and monthly configuration files.

- rc file syntax
  following keywords are valid:
  packer=<path to packer program>

  compress=<option to packer program to compress data>
  IMPORTANT: Packer program must output data to stdout (i.e. for gzip use -c)

  packdir=<path-to-archive-dir>
  basedir to store rotated/archived files

  fromuser=<sender address>
  Sender address used in mail messages

  touser=<receiver address>
  Receiver of mail messages
 
  notifempty
  Do not rotate the log if it is empty.

  mail=<mailer prg>
  Mail program to send messages. Must be used option to read header recipient
  addresses.


- daily|weekly|monthly file syntax:

  <logfile1>,<logfile2>,... {
   <storedir> <path-to-dir>
   <logpart> <qdldl>
   <postrotate> ... <endscript>
   <prerotate> ... <endscript>
   <delaycompress>
   <nocompress>
   <touser> <email address>
   <create mode owner group>
   <ifempty>
   <noifempty>
   <rotate> <number>
  }

  Where:
  
  logfile1, logfile2, ... 
  Is a comma separated list of complete absolute path to logfiles to 
  archive/rotate

  storedir <path-to-dir>
  If it's a relative path it will be appended to packdir defined in rc file,
  if it's an absolute path it will be used instead of packdir

  logpart <qdldl>
  Leave a part of log to archive/rotate in logfile.
  qdldr can be:
  <number>l
  <number>b
  "<regexp>"
  "<#1 day>"
  Where l and b means lines and bytes respectively.
  "regexp" is a regular expression used by grep to find first row to leave in 
  log.
  "#1 day" is a shortcut to leave in log all events recorder from first day of 
  current month.

  prerotate ... endscript
  Lines between prerotate and endscript (both of which must appear on 
  lines by themselves) are executed before the log file is archived/rotated. 
  
  postrotate ... endscript
  Lines between postrotate and endscript (both of which must appear on 
  lines by themselves) are executed after the log file is archived/rotated. 

  nocompress
  Old versions of log files are not compressed with packer defined in rc
  file

  delaycompress
  Postpone compression of the previous log file to the next rotation
  cycle.
  It can be used when some program can not be told to close its
  logfile and thus might continue writing to the previous log file for
  some time.

  touser <email address>
  Override global value of touser variable defined in rc file

  create <mode owner group>
  Immediately  after  rotation (before the postrotate script is run)
  the log file is  created  (with  the same  name  as  the  log  file
  just rotated).  mode specifies the mode for the log file in  octal
  (the same  as  chmod(2)),  owner specifies the user name who will
  own the log file, and group specifies  the group  the  log file will
  belong to. Any of the log file attributes may be omitted, in which
  case those attributes  for the new file will use the same val- ues as
  the  original  log  file  for  the  omitted attributes.

  ifempty
  Rotate the log file even if it is empty, overriding the notifempty option
  
  notifempty
  Do not rotate the log if it is empty

  rotate <number>
  Log files are rotated <number> times before being removed.
       
