jamesoff / simplemonitor

A Python-based network and host monitor
https://simplemonitor.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
407 stars 166 forks source link

monitor.log : Timestamp not in friendly reading format #1474

Open xMadNet opened 1 month ago

xMadNet commented 1 month ago

simplemonitor 1.13.0 Linux Xpi4Test 6.6.22-v8+ #1747 SMP PREEMPT Wed Mar 27 17:04:50 GMT 2024 aarch64 GNU/Linux Hi In monitor.log : 1729012751 ping-ANT-PortierEcranMaison: ok (4.000s) When -v used (so to screen ) : 2024-10-15 19:18:58 INFO (simplemonitor) monitor passed: ping-ANT-PortierEcranMaison Is it possible to have same format in monitor.log ?

Also is it possible to write -l LOGLEVEL to monitor.log ?

BR

jamesoff commented 1 month ago

Hi :)

Is it possible to have same format in monitor.log

This is supposed to be configurable, but it looks like it's not covered properly in the documentation. I'll fix that.

Can you try adding

dateformat=iso8601

to your logger configuration? Something like this:

[file4]
type=logfile
filename=monitor4.log
dateformat=iso8601

Also is it possible to write -l LOGLEVEL to monitor.log

I'm not sure what you mean? Do you mean like the output printed normally for the loglevel (e.g. debug) to go to that file too? I do that just by redirecting the output from the program to a log file with a redirect or by using a service wrapped (e.g. daemontools).

jamesoff commented 1 month ago

Ah I found where in the docs that option is covered - it's mentioned for the logfile monitor and explained in the common options part: https://simplemonitor.readthedocs.io/en/latest/loggers.html#confval-dateformat