Next: , Previous: Configuration parameters, Up: Top


1.6 Use of meta-variables

In monthly/weekly/daily logs metavariables can be used. Metavariables are identifiers of a runtime defined value and can be used while using following parameters:

     storedir
     storefile
     prerotate...endscript
     postrotate...endscript

List of handled metavariables:

@DIRNAME
Dir containing logfile to be archived/rotated.
@FILENAME
Name of the file to be rotated with numerical extension (@BASENAME.@NEXT_EXT).
@BASENAME
Name of the file to be rotated, without extension.
@DEF_DIR
Default dir of archive dir (corresponding to packdir variable).
@COMP_EXT
Extension of compressed file (corresponding to extension variable).
@NEXT_EXT
Next available numbered extension in destination dir.
@TEMPDIR
Name of a temporary directory.
@1..@n
String corresponding to first, second, etc, on directory in dirname of file to archive/rotate
@YEAR
Return current 4 digit year (i.e. 1970).
@MONTH
Return current month (01..12).
@WEEK
Return number of week in year (0..53) to SunMon variable.
@DAY
Return current day of month (01..31).

Values of metavariables are defined while the script is running, so a block definition like this

          /var/adm/log.* {
            storedir /var/adm/archive-log/@BASENAME
            rotate 5
            ...
          }

means that rottlog will rotate 5 times all files in /var/adm beginning with "log." and store each file in a dir named with logname. (i.e. /var/adm/archive-log/log.kern, /var/adm/archive-log/log.daemon...)

WARNING: Metavariables substitution is merely textual!

So in a block like this

          /var/http/www.mysite.com/log/access.log {
            storefile @3-@13-@FILENAME
            rotate 4
            ....
          }

rottlog will create logfiles called something like www.mysite.com-var3-access.log.1

Because @13 is not defined (complete absolute filename in first line of block definition contains only 5 tokens) and only @1 will be substituted. Following text will not be affected (remaining 3-) and will NOT generate an error code.