Re: Adding timestamp to maillog

Peter Pentchev <[email protected]>
Newsgroups gmane.mail.fetchmail.user
Message-ID <[email protected]>
On Thu, Sep 10, 2020 at 01:43:36PM -0700, James Moe via Fetchmail-users wrote:
> On 9/10/20 10:36 AM, Dennis Putnam wrote:
> 
> > Has anyone figured out how to add a timestamp on the fetchmail log
> > messages to the maillog? TIA
> >
>   Not that I ever found.
>   My configuration file has these entries as a workaround:
> 
> set logfile "/path/to/fetchmail.log"
> poll example.com interval 1
>   protocol imap username "account_name_of_interest" password "secret"
>   preconnect "echo `date +%Y-%m-%dT%H:%M:%S` <account_name_of_interest> >>
> /path/to/fetchmail.log
>   ... other stuff ...
> 
>   It does result in an entry for every time fetchmail connects to a server to
> check for mail even if no mail is available.

Huh... I guess I never thought I'd need that, since I've always run
fetchmail in daemon mode with the -v option, and (at least for a long
time, maybe always) it outputs lines like:

fetchmail: 6.4.8 querying mail.example.com (protocol IMAP) at 11.09.2020 (пт)  0:46:26: poll started
...
fetchmail: 6.4.8 querying mail.example.com (protocol IMAP) at 11.09.2020 (пт)  0:48:26: poll completed
fetchmail: sleeping at 11.09.2020 (пт)  0:48:26 for 120 seconds

(the "пт" part is the Bulgarian abbreviation for "Friday")

Other than that, I'd suggest somehow running a combination of fetchmail
and one of the logging tools like Prof. Bernstein's "multilog", but that
would require a reliable mechanism of starting both processes and making
sure both of them keep running, and there are not so many ways of doing
that if not using a service supervision framework like daemontools,
runit, s6, or similar. Of course, one could always write a simple Perl /
Python / Ruby / Rust / maybe even C program that starts two processes
and kills them both if anything bad happens, but that's not what I'd
consider an easy general solution.

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-----

iQIzBAABCgAdFiEELuenpRf8EkzxFcNUZR7vsCUn3xMFAl9aoE4ACgkQZR7vsCUn
3xOpAg//VPB4vBLKf6ORiKPw+76GKx3YNWiMs1WKuks2lcfRKe18h3k4+r/gsyzO
PmoE9zmWxWqIYOZVzY31LKYQ8mDRAa8cfLxte7hwdph4QY6eO+wRpx3qLcb3zUpx
2MzEBioHxJs3K0aSqAi7dA+sgqB/SOPApuLLTf6bOZdN47b1Xepn8A2HFwgXrPus
6ArrMtnaOCpC12CfFHfk3VyDk4yzsyVA819TEHVITDL7Mj4yBAlI03+NR/XyQ49v
f1nayswHuhSv60N2Hq9jTYN3OkeKIDiNrB7cm0IahlKhyMZNyUK+iSoBfO+383RR
FMWiCDO+3NTFx8KDQ5Dn2BE+tz5pjIZe3IEFLXvN6yQ8dVxWo9iTyBeZEcL2PKAm
Y/hyzf7ODKngnh59FCc8AKvdHUbLs2jS74o0WH5TWkja7000EEJ8tNoe0Pm7RGRy
O1XeEplGPIShKsRh9sOZR5UpOpa2PQ0D3ZE0W7HWo9fsUZ75lE1MwiffZU+Jvzw1
lYo1qBtGYo1vY6lul6OjXBxbDNitoNVjl5kHTj4UNx8uImpa2OtJu1mr67Rj/ocU
HTNCBO49IfOlyM9HfhfMjOKGXlSwtIq++xdRM362lNw4mlApP9IxcUMNGCuPoelG
fkc8MR25WoyLHHSdrYxsbjY0lqQvKNODsA3Cup2vVbypR485GUk=
=aQT/
-----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.