Nagios Log Date Format

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
rajasegar
Posts: 1018
Joined: Sun Mar 30, 2014 10:49 pm

Nagios Log Date Format

Post 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.
5 x Nagios 5.6.9 Enterprise Edition
RHEL 6 & 7
rrdcached & ramdisk optimisation
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Nagios Log Date Format

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

Re: Nagios Log Date Format

Post 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
Nagios XI 5.8.1
https://outsideit.net
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Nagios Log Date Format

Post 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.
Former Nagios employee
Locked