Hi,
Is there a way to change the the way Nagios writes the date in nagios.log file instead of epoch to a human date?
[1493793917] Event broker module 'NERD' deinitialized successfully.
[1493793917] ndomod: Shutdown complete.
[1493793917] Event broker module '/usr/local/nagios/bin/ndomod.o' deinitialized successfully.
Change epoch time to date in nagios.log
Re: Change epoch time to date in nagios.log
Try using perl -pe 's/(\d+)/localtime($1)/e' to convert the time to a "human readable" format.
Example:
Example:
Code: Select all
tail -50 /usr/local/nagios/var/nagios.log | perl -pe 's/(\d+)/localtime($1)/e'Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: Change epoch time to date in nagios.log
this does the trick, is there a way to force NAgios save it inside the logs to avoid from using such long command everytime?
I also don't want to create alias for this command.
I also don't want to create alias for this command.
-
avandemore
- Posts: 1597
- Joined: Tue Sep 27, 2016 4:57 pm
Re: Change epoch time to date in nagios.log
No there is not a way which will not break things.
Previous Nagios employee
Re: Change epoch time to date in nagios.log
Did you have any further (related) questions or are we okay to close this thread?
Former Nagios employee