Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 150933 - syslog logrotate configuration file(s)
Summary: syslog logrotate configuration file(s)
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: Normal enhancement
Assignee: Net-Mail Packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-10-11 15:29 UTC by Olliver Schinagl
Modified: 2008-06-15 08:22 UTC (History)
2 users (show)

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


Attachments
postfix logrotate script (postfix,222 bytes, text/plain)
2006-10-11 15:31 UTC, Olliver Schinagl
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Olliver Schinagl 2006-10-11 15:29:17 UTC
I noticed my mail.info and mail.log was starting to grow rather ... big.

I then created a simple logrotate script for postfix. It would be great if it got tested and installed with the latest postfix ebuild.
Comment 1 Olliver Schinagl 2006-10-11 15:31:15 UTC
Created attachment 99390 [details]
postfix logrotate script

qmail, exim etc users browing here by accident, This script can work for you just as well if you replace postfix with qmail inside the script, given that 'reload' restarts writing log files. If not, also replace reload with restart.
Comment 2 Tuan Van (RETIRED) gentoo-dev 2006-10-12 08:41:36 UTC
(In reply to comment #1)
> Created an attachment (id=99390) [edit]
> postfix logrotate script
> 
> qmail, exim etc users browing here by accident, This script can work for you
> just as well if you replace postfix with qmail inside the script, given that
> 'reload' restarts writing log files. If not, also replace reload with restart.
> 

then why don't we let logrotate provide that file instead. BTW, syglog-ng does not log to mail.* by default.
Comment 3 Olliver Schinagl 2006-10-30 15:28:23 UTC
I don't know what syslog-ng does by default, but something by gentoo-default made it log to mail.* I haven't changed it, some default gentoo setting has.

As for supplying it with logrotate, I don't know if it should supply the scripts for all possible apps? There's might be differences between all mailers, you have to restart your mailer and thus it's not a 'generic' solution.
Comment 4 Sylvain Demers 2006-11-26 08:11:50 UTC
I think each program should supply it's own logrotate file. I guess logrotate is fairly common on Linux/Unix machines, so I would tend to include the rotate file by default. Maybe a "logrotate" or "nologrotate" USE flag? Apache does this (without the USE flag): see bug 42537.

As for Postfix: does Postfix itself writes /var/log/mail.*, or does it give that to the system logger? If the system logger writes the actual file, then Postfix doesn't need to know when the log files are rotated. If this is the case, the logrotate file should be provided by the logger - the postrotate script would then be independent of the mailer.
Comment 5 Andrej Kacian (RETIRED) gentoo-dev 2006-11-26 15:32:17 UTC
(In reply to comment #4)
> As for Postfix: does Postfix itself writes /var/log/mail.*, or does it give
> that to the system logger? If the system logger writes the actual file, then
> Postfix doesn't need to know when the log files are rotated. If this is the
> case, the logrotate file should be provided by the logger - the postrotate
> script would then be independent of the mailer.

Postfix uses the "mail" facility of system logger. Therefore it is impossible to determine location and name of mail log files, as these can be dictated by said logger configuration. There doesn't even have to be a separate log file for mail facility, if someone configures his system logger to put for example "mail" and "cron" facility logs into one file.
Comment 6 Sylvain Demers 2006-11-26 19:15:04 UTC
(In reply to comment #5)
> Postfix uses the "mail" facility of system logger. Therefore it is impossible
> to determine location and name of mail log files

Then each of the sysloggers could provide a logrotate file according to their defaults. In the case of sysklogd, 'mail.err', 'mail.info', 'mail.log', and 'mail.warn'. Administrators changing the syslogger's default would also have to ajust the rotation file.
Comment 7 Olliver Schinagl 2006-11-27 14:21:59 UTC
So there's 2 options.

Supply rotate files for every MTA out there, and generate/get/assume the directory/file in question (/var/log/mail.*)

or

Let the packages maintain the rotate files, and set the default directory/file to whatever the packages ebuild mail loging is setup (e.g. via syslog*, seperate mailfiles, syslogs's mail facility).

Since the package knows everything about the files in questions, it sounds sensible to me that MTA's supply their own rotate file. Also keeping the useless files out of the system. E.g. why need 6 rotate files for 6 MTA's installed, when i don't even have one installed.

So i say/vote/opinion/whatever use the supplied script, add it to the postfix ebuild and we're all happy :)

(there's a minor typo in the comment, Contributes -> Contributed)
Comment 8 Sylvain Demers 2006-11-27 14:43:40 UTC
In the case of Postfix, it doesn't know anything about the log files because it asks syslog to take care of it. That's why I was saying syslog should handle the mail.* logs. Exim, qmail, and sendmail might be different - I don't know.

Basically: the package that writes the file should provide the logrotate script.
Comment 9 Olliver Schinagl 2006-11-27 15:58:30 UTC
Hmm, So you either end up with a bunch of rotate files, that you may have no use off, which I find to be messy, or postfix supplies the file, but doesn't know which files need to be rotated, e.g. /var/log/mail.* or maybe a private logfile, /var/log/postfix/postfix.log  since afaik you can choose wether to use syslog or built in logger.

In the sense of keeping crap off systems, I still feel to add the file to postfix's ebuild. It belongs to it. Just like conf.d and init.d files belong to it aswell.
Comment 10 Andrej Kacian (RETIRED) gentoo-dev 2007-02-04 03:38:59 UTC
(In reply to comment #9)
> In the sense of keeping crap off systems, I still feel to add the file to
> postfix's ebuild. It belongs to it. Just like conf.d and init.d files belong to
> it aswell.

No, logrotate file does not belong to postfix, as its default setting is to log via system logger. If you change the configuration to have postfix write log files directly, then you need to provide your own logrotate script.

I'm sending this bug to base-system, as they maintain metalog and sysklogd, two most common syslog daemons, both of which log mail facility to separate files. They can decide whether to add this support to the packages or not.
Comment 11 SpanKY gentoo-dev 2007-02-04 07:31:51 UTC
it's up to individual packages to install small logrotate snippets into /etc/logrotate.d/

see the logrotate USE flag
Comment 12 Andrej Kacian (RETIRED) gentoo-dev 2007-02-04 13:31:37 UTC
I know about the USE flag, but I agree with Sylvain - postfix doesn't know anything about log files itself. I couldn't even find a way to make postfix write its own log files, so I assume it relies on system logger.

Therefore system loggers should provide logrotate scripts for mail facility log files - in fact, for any and all log files they create with default configurations. Syslog-ng does that, although that one doesn't log mail facility separately.

vapier?
Comment 13 Sylvain Demers 2007-02-04 14:21:27 UTC
(In reply to comment #9)
> Hmm, So you either end up with a bunch of rotate files, that you may have no
> use off, which I find to be messy

Actually, no. Any MTA that uses sysklogd will have its log end up in "mail.*". sysklogd doesn't need separate logrotate files for each MTA. Since each computer has no more than one syslogger, there would be only a single logrotate file for mail - even if you were to have mutliple MTAs on your system.

On the other hand, if the MTA is to provide the logrotate file, it has to provide as many logrotate files as there are sysloggers in Portage, because it doesn't know which one is installed. So there you end up with multiple files that you are sure you won't use except for one. And should a new syslogger be introduced into Portage, we have to update all the packages that rely on a syslogger.

(In reply to comment #9)
> it's up to individual packages to install small logrotate

Yes, and the package that handles those files is the syslogger's.

Another situation is one where the MTA and the system logger are on different systems. Having the logrotate snippet in the MTA's package can never rotate the log files, because those are stored on another computer, which doesn't have an MTA, and therefore no logrotate snippet.

Granted, that situation won't happen often, and won't be done by first-time users, but having the syslogger provide the logrotate snippet would prevent having to configure more that the syslogger redirection.
Comment 14 Fernando J. Pereda (RETIRED) gentoo-dev 2007-02-04 16:02:58 UTC
The only one that knows where stuff is being logged to is the system logger. It is up to the logger to rotate its files, nothing to do with postfix. Thats one of the joys of centralizing stuff...

However, we could offer an example logrotate file that rotates mail.* files... it is silly in my opinion, but we can do it. Anyway, I don't think we'll install that by default in /etc/logrotate.d... /usr/share/doc/${PF} sounds like a plan.

- ferdy
Comment 15 SpanKY gentoo-dev 2007-02-04 22:58:24 UTC
oh, i see ... i was under the impression postfix was doing the logging

metalog does not need any logrotate cruft as it does file rotation itself

as to whether it's better to include the snippet with the system logger or logrotate, i guess that it's prob better with the system logger as already noted
Comment 16 Tobias Scherbaum (RETIRED) gentoo-dev 2008-06-15 08:22:13 UTC
metalog has its internal logic to rotate logfiles, syslog-ng installs a configfile for logrotate which also includes rotating mail.* logfiles and sysklogd installs a cron script for logrotation which includes explanations for adding logfiles to rotate - i guess this one can be closed? doing so - feel free to reopen if you disagree.