Page 1 of 1
Nagios Log Date Format
Posted: Thu Oct 02, 2014 10:43 pm
by rajasegar
NagiosXI 2014R1.2
Is it possible to permanently change the date format in nagios.log?
It is such a pain to have it in the decimal format which serves no purpose to us.
Thanks.
Re: Nagios Log Date Format
Posted: Fri Oct 03, 2014 9:33 am
by lmiltchev
I am not sure if "permanent" change is possible withing breaking the functionality, but you can always run:
Code: Select all
tail /usr/local/nagios/var/nagios.log | perl -pe 's/(\d+)/localtime($1)/e'
to view the timestamps in "human readable" format.
Re: Nagios Log Date Format
Posted: Fri Oct 03, 2014 12:24 pm
by WillemDH
Thank you Ludmill fir this nice tip. I will be able to use that. The Unix timestamps can be very confusing.
Grtz
Willem
Re: Nagios Log Date Format
Posted: Fri Oct 03, 2014 12:27 pm
by tmcdonald
If I can throw my two cents in, the prevalence of the UNIX timestamp is largely due to how precise it is. There is no need to figure out a multitude of date formats (mm/dd/yyyy, dd/mm/yyyy, yy,mm,dd) and 12- vs 24-hour clocks. It is just an integet, and the conversion is very easy. It's terrible for humans to read, but there are enough ways to deal with it like ludmil's suggestion that it is a minor annoyance at worst.