From:
[email protected]
Regarding this issue I send you the three little relevant patches
extracted from the logrotate-3.7-33.src.rpm SUSE package.
They apply cleanly over your current package (3.7-2) adding two new
directives:
dateext
Archive old versions of log files adding a daily extension
like YYYYMMDD instead of sim- ply adding a number.
maxage count
Remove rotated logs older than <count> days. The age is only
checked if the logfile is to be rotated. The files are mailed
to the configured address if maillast and mail are con-
figured.
... that seems very useful in rsync scenarios.
TIA.
#! /bin/sh -e
## 901-dateext.dpatch by <
[email protected]>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: No description.
if [ $# -lt 1 ]; then
echo "`basename $0`: script expects -patch|-unpatch as argument" >&2
exit 1
fi
[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts patch_opts="${patch_opts:--f --no-backup-if-mismatch} ${2:+-d $2}"
case "$1" in
-patch) patch -p1 ${patch_opts} < $0;;
-unpatch) patch -R -p1 ${patch_opts} < $0;;
*)
echo "`basename $0`: script expects -patch|-unpatch as argument" >&2
exit 1;;
esac
exit 0
@DPATCH@
diff -urNad /usr/src/pool/logrotate/w/logrotate-3.7/config.c logrotate-3.7/config.c
--- /usr/src/pool/logrotate/w/logrotate-3.7/config.c 2004-08-18 15:19:07.000000000 +0000
+++ logrotate-3.7/config.c 2004-08-18 15:19:23.000000000 +0000
@@ -513,6 +513,14 @@
newlog->flags &= ~LOG_FLAG_IFEMPTY;
*endtag = oldchar, start = endtag;
+ } else if (!strcmp(start, "dateext")) {
+ newlog->flags |= LOG_FLAG_DATEEXT;
+
+ *endtag = oldchar, start = endtag;
+ } else if (!strcmp(start, "nodateext")) {
+ newlog->flags &= ~LOG_FLAG_DATEEXT;
+
+ *endtag = oldchar, start = endtag;
} else if (!strcmp(start, "noolddir")) {
newlog->oldDir = NULL;
diff -urNad /usr/src/pool/logrotate/w/logrotate-3.7/logrotate.8 logrotate-3.7/logrotate.8
--- /usr/src/pool/logrotate/w/logrotate-3.7/logrotate.8 2004-08-18 15:19:08.000000000 +0000
+++ logrotate-3.7/logrotate.8 2004-08-18 15:19:23.000000000 +0000
@@ -210,6 +210,11 @@
Log files are rotated every day.
.TP
+\fBdateext\fR
+Archive old versions of log files adding a daily extension like YYYYMMDD +instead of simply addin