From: Peter P. <ro...@ri...> - 2022-01-20 00:06:38
|
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.logrotate 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 |