Package: logrotate
Version: 3.7-5

Suggestion: preprocess config files with m4

Here's the motivation:

I recently asked Martin Schulze, maintainer of the Debian sysklogd
package, why it didn't use logrotate. His explanation was essentially
that logrotate couldn't do everything the sysklogd cron script does
(more specifically, automatically extract the list of log files from
syslog.conf, which is currently done by the syslogd-listfiles script).

While there seem to be some simple work arounds (such as what I did on
my system, which was to place all the syslog managed log files into
/var/log/syslog/ and make sure they all consistently ended with .log so
a simple /var/log/syslog/*.log wild card would find them, or even
manually maintaining the list of log files in a logrotate script doesn't
seem so bad of a trade off in order to gain the benefits of logrotate
and consistency of managing all log files in the same way), Martin seems
to feel that any solution that doesn't preserve 100% of the
functionality of the current cron script would be a "regression."

Yet the disconnect between logrotate and sysklogd does seem to be
causing some confusion, as evidenced by bugs:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=308963
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=316983

I considered a few ways such functionality could be hacked in. One might
be having a separate cron script that autogenerated a logrotate config file for sysklogd, but that would be ugly, and it essentially defeats the goal of improving the consistency in how log files are managed. It would also be inflexible. If the admin wants some rotated daily and some weekly, it would mean creating multiple cron scripts and multiple logrotate scripts.

It seems the cleaner approach would be patching logrotate so that it
calls to an external script to obtain the list of log files to operate
on. Hopefully such a patch would largely borrow from the existing
post/pre-rotate script directives. It could be something like:

`/usr/sbin/syslogd-listfiles --weekly` {
        weekly
        olddir /var/log/syslog/old
        sharedscripts
        postrotate
                /etc/init.d/sysklogd reload-or-restart > /dev/null
        endscript
}

But an even simpler solution, which could be implemented with a fairly small and localized patch, would be to preprocess config files with m4 before logrotate processes them. Then the above becomes:

esyscmd(/usr/sbin/syslogd-listfiles --weekly) {
        weekly
        olddir /var/log/syslog/old
        sharedscripts
        postrotate
                /etc/init.d/sysklogd reload-or-restart > /dev/null
        endscript
}

and it also open up the door for using other capabilities of m4.

Please advise on how likely a patch to do this would be accepted and whether this matter should be taken up with the upstream maintainers (if so, please provide advice on how best to submit this).

 -Tom



--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to