Re: logrotate options?

Peter Pentchev <[email protected]>
Newsgroups gmane.mail.fetchmail.user
Message-ID <[email protected]>
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  [email protected] [email protected] [email protected]
PGP key:        http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint 2EE7 A7A5 17FC 124C F115  C354 651E EFB0 2527 DF13

_______________________________________________
Fetchmail-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fetchmail-users
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEELuenpRf8EkzxFcNUZR7vsCUn3xMFAmHop3cACgkQZR7vsCUn
3xOF4BAAp0fAyO8RO0nXzLCqPA4a7cd8GGPcE31gOAzDQBrUncmY5lFRxN9qcVD2
BwYfbHyQdnFz/2UP00sFKn9ezIkpgcAVoplhHdCebMJl5pYJpb8SymRNAW8ZjKnV
jOPrXtnc0wr5V0lyKEihsxXZoot++h34idpstpMGvpFNpJ169opec/ye5yEtxEcg
xLdUti6hpsMbYxGTz5T9Bh6VE9XDCk//BU4TSefGRRs5Ud3E9tUTN+ptlpvnSOpl
QZUgUHCUtjXBR8iBIYgwdj1NA6L/My86z0DBcUmDkYeoaxQjHnDTgwN56U2rxYTM
jMOe/WL+3OMBYQiy4f8q6i5z8CRJCKYAsAw/q0Gn2cZCsMaMmiefYPnuwZFIpcfF
f99qzbARBjWBWZtg+B0yqRqLWBX49D5J4ztg96Ju9YxERRNpk93/wNNqjEYjVuBC
QbJnjV+YqoeKzQ5n0iX5T/jaRG9CrDw5Xj6b45H4Gb/IpOwowjgE+X10R90K+3zw
mozRQNPpXKKUuBN8Qc+1riZHyCFB4sD0Ii5db8g1fan/Cn4baLOihjrspxhYYRyO
j7KpUMxQcCKQP/Xa7r4ik66Xs1fUoV3GjhFGM/6T9R5pemy7ZXTRVTFjU9PtwOfC
VbbqPo+ALKl+BkGZydrGg7+S1YWsWRqYaE/euFyM+SCywqYqmJw=
=2VWO
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.