From: Joe Acquisto-j. <jo...@j4...> - 2022-01-20 03:19:13
|
> On Wed, Jan 19, 2022 at 04:35:35PM -0500, Joe Acquisto-j4 wrote: >> This is fetchmail release 6.4.21+SSL-SSLv2-SSLv3+NLS >> >> Looking for examples I can follow to implement log rotation with >> fetchmail. Links, examples, tutorials kindly accepted. > > If you have the logrotate tool installed on your system, the fetchmail > source contains a sample fetchmail.logrotate file: > > > https://gitlab.com/fetchmail/fetchmail/-/blob/next/contrib/fetchmail.logrota > te > > Of course, you can customize it however you wish - specify different > rotation criteria, point to a different fetchmail logfile - but, most > importantly, you will most probably need to modify the command to be > executed after the logfile has been rotated - the contents of > the logrotate configuration file's "postrotate" section. > In the sample file, the command in the postrotate section is a POSIX > shell "if" statement that examines the server that it is running on and > figures out the appropriate command to run to make the fetchmail > instance that is running as a system service reopen its logfiles. > > If you run fetchmail as root, something like that will probably work for > you. If you run fetchmail from a normal user account, there might be > a slight problem here, since the logrotate tool will need to restart > fetchmail. So if your fetchmail instance is run under some kind of > service manager (supervise, runsv, a systemd user service, etc), then > the postrotate section is where you place the appropriate command to > restart that particular service. > > Of course, if you run fetchmail under some kind of service manager, then > there may be no need for a separate logfile at all, since most of > the service managers can already handle a program that sends messages to > its standard output stream, as fetchmail does by default in daemon mode. > So that service manager's functionality may already provide some kind of > log storage and rotation, and you don't need the logrotate tool. > > Hope that helps! In short, it all depends on how you run fetchmail. > > G'luck, > Peter > > -- > Peter Pentchev ro...@ri... ro...@de... pp...@st... > PGP key: http://people.FreeBSD.org/~roam/roam.key.asc > Key fingerprint 2EE7 A7A5 17FC 124C F115 C354 651E EFB0 2527 DF13 Some well strained infant food and spoon feeding may be required here. I've never had to deal with logrotate before this, which may be obvious. It is not clear to me how logrotate runs. That would be a first spoonful. The linked config seems decipherable but I pause at the post rotate part as it is not apparent where fetchmail was stopped prior to this. I imagine it must be paused to "quiesce" the log. Or is that necessary? That config post rotate stuff looks to be for init.d, while my stuff uses systemd. I never got fetchmail to start (or maybe restart) properly, so am just starting with fetchmail -v (I like noisy logs). But that is another story. I may have to disengage for the evening and restart tomorrow, joe a. |