Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 324401 - app-admin/sysklogd: add USE=logrotate support to disable bundled cron jobs
Summary: app-admin/sysklogd: add USE=logrotate support to disable bundled cron jobs
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-16 21:18 UTC by Hank Leininger
Modified: 2013-04-27 08:55 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
New sysklogd ebuild that respects the logrotate USE flag (sysklogd-1.5-r1.ebuild,1.79 KB, text/plain)
2010-06-16 21:20 UTC, Hank Leininger
Details
Patch to add USE=logrotate flag to sysklogd-1.5-r2.ebuild (sysklogd-1.5-r2_use_logrotate.patch,997 bytes, patch)
2012-11-02 23:35 UTC, Hank Leininger
Details | Diff
/etc/logrotate.d/ config file for sysklogd's default configuration (sysklogd.logrotate,410 bytes, text/plain)
2012-11-02 23:36 UTC, Hank Leininger
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Hank Leininger 2010-06-16 21:18:13 UTC
Here's a new sysklogd ebuild that does not automatically enable the Debian cron log rotation scripts if you are using logrotate.

sysklogd has since maybe version 1.5 was released, shipped its own very simplistic log rotation cron jobs.  sysklogd-1.5.ebuild installs them in /etc/cron.daily/ and /etc/cron.weekly/ automatically (they are not even flagged as config files and thus subject to review by etc-update).

logrotate provides more options and a cleaner config file than editing these scripts.  If one has both installed, they fight over syslog log files.

So, I've created an updated sysklogd .ebuild that respects the logrotate USE flag.  It puts the rotation scripts not directly in /etc/cron.{daily,weekly} but in /usr/sbin, and then creates symlinks into /etc/cron.{daily,weekly} only if the logrotate USE flag is not enabled.

Reproducible: Always

Steps to Reproduce:
1. Install logrotate.
2. Install sysklogd.
3. Remove sysklogd's cron jobs because you prefer logrotate.
4. Upgrade sysklogd (some day).
5. Cry because those cron jobs are back and you did not want them, and now you cannot find your nicely moved-to-old/, named-with-date-extension, compressed logs, and the new logfiles are not created your preferred ownership, etc.
Comment 1 Hank Leininger 2010-06-16 21:20:06 UTC
Created attachment 235649 [details]
New sysklogd ebuild that respects the logrotate USE flag
Comment 2 Hank Leininger 2010-06-16 21:26:32 UTC
I should add that my /usr/sbin/, dosym handwaving might well not be the right way to fix this.  For instance, one could argue that the log rotation scripts derived from Debian are indeed config files, so /usr/sbin/ isn't an appropriate place for them--if you do use them, you may want to change them, in which case they should be covered by etc-update.
Comment 3 SpanKY gentoo-dev 2010-06-16 21:58:46 UTC
Comment on attachment 235649 [details]
New sysklogd ebuild that respects the logrotate USE flag

post a diff, not a full file.  and yes, these should not be installed into /usr/sbin.

you can already disable these files on your system by adding 'exit 0' to the top and etc-update should allow you to merge things.  does this not work for you ?
Comment 4 Samuli Suominen (RETIRED) gentoo-dev 2010-06-16 22:01:20 UTC
and bug 198901 ?
Comment 5 SpanKY gentoo-dev 2010-06-16 22:03:02 UTC
this isnt really the same as that bug because in this case, we arent installing config files for the logrotate package.  we're enabling the built-in logrotate functionality of sysklogd (albeit, via cron.d files in /etc/).
Comment 6 Hank Leininger 2010-06-16 22:34:59 UTC
> post a diff, not a full file.

Thanks, will do in the future.

For some reason I did not think etc-update was doing the right thing wrt these.  Perhaps I had only tried chmod -x'ing them to disable them, but not tried adding exit's at the top (in which case they are silently +x'ed when next emerging the package).

I was wrong in my original statement: sysklogd does not "[ship] its own very simplistic log rotation cron jobs".  Those scripts are not part of the sysklogd distribution.  The ebuild adds them by importing a Debian patch set.

wrt doing away with the logrotate use flag, note that the "well that seems OK" exception was for squid, which uses logrotate in exactly the manner I want sysklogd to do (except I was trying to preserve copies of those files even if logrotate was used--I'd be happier to just not install them at all, like squid).

To me, logrotate and these bundled scripts (not native to sysklogd, remember) provide duplicate functionality, but logrotate does it better (more features, cleaner to configure).  I want a knob to be able to specify which I prefer, and to only have to turn it once.  People may choose not to use logrotate, fine and good.  But if you do choose to use logrotate, what use are the scripts that are added to sysklogd, and which are turned on unconditionally?

Most packages that PROVIDE virtual/logger do only that, log, not rotate/manage logfiles.  For example:
- syslog-ng: no log-management of any kind
- rsyslog: no builtin log-management, except drops a logrotate.d/ file
- metalog: _does_ do logfile-management natively, part of its core functionality
 (manage files by size or age)
- syslogread: no log-management of any kind

Perhaps the right way to do this is not to USE logrotate, but to create virtual/logrotation or something, which can be provided by logrotate or some other package (including somebody's home-grown scripts if they prefer) which tells the packages that care, "don't worry about log rotation, I've got it covered."
Comment 7 SpanKY gentoo-dev 2010-06-16 22:53:36 UTC
i dont use sysklogd, so i'm not really familiar with the functionality it provides.  does it install logrotate files that can be used with app-admin/logrotate already ?
Comment 8 Hank Leininger 2012-11-02 23:35:27 UTC
Created attachment 328162 [details, diff]
Patch to add USE=logrotate flag to sysklogd-1.5-r2.ebuild
Comment 9 Hank Leininger 2012-11-02 23:36:17 UTC
Created attachment 328164 [details]
/etc/logrotate.d/ config file for sysklogd's default configuration
Comment 10 Hank Leininger 2012-11-02 23:38:49 UTC
Sorry for not getting back to this for so long.

sysklogd doesn't currently include a logrotate conf file.  I've attached one that matches the files created by the syslog.conf file that sysklogd-1.5-r2 installs by default, and a patch to sysklogd-1.5-r2.ebuild that deploys this logrotate file if USE=logrotate, or otherwise uses the currently bundled simple cron scripts.

* This version doesn't install the bundled script at all if USE=logrotate.  If they should go in /usr/sbin/ (or /usr/share/doc/sysklogd-*) let me know, I'll rework the patch.
Comment 11 Hank Leininger 2013-04-02 03:05:57 UTC
Ping... any thoughts on this / chance it can get included, and sysklogd 1.5 marked stable?

(Is there a more appropriate way to bump an existing bug than to add a new comment to it?)
Comment 12 SpanKY gentoo-dev 2013-04-27 08:54:19 UTC
(In reply to comment #11)

i know nothing about sysklogd, nor care about it.  your patches look sane though, let's toss them in and see what goes boom.