dateext
Archive old versions of log files adding a daily extension
like YYYYMMDD instead of simply adding a number. The extension
may be configured using the dateformat and dateyesterday
options.
dateformat format_string
Specify the extension for dateext using the notation similar
to strftime(3) function. Only %Y %m %d and %s specifiers are
allowed. The default value is -%Y%m%d. Note that also the
character separating log name from the extension is part of
the dateformat string. The system clock must be set past Sep
9th 2001 for %s to work correctly. Note that the datestamps
generated by this format must be lexically sortable (i.e.,
first the year, then the month then the day. e.g., 2001/12/01
is ok, but 01/12/2001 is not, since 01/11/2002 would sort
lower while it is later). This is because when using the
rotate option, logrotate sorts all rotated filenames to find
out which logfiles are older and should be removed.
dateyesterday
Use yesterday's instead of today's date to create the dateext
extension, so that the rotated log file has a date in its name
that is the same as the timestamps within it.
De skal så bruges sammen, og ikke hver for sig som man(8) ligger op til. Så ved at tilføje
Kode: Vælg alt
dateext dateyesterday
til en af logrotate's konfigurationsfiler, får man skrevet den dato på loggen, som den indeholder
Kode: Vælg alt
/var/log/mail.log-20140429