FW: Howto replace epoch secs in nagios.log by human readable date ?

Marc Powell marc at ena.com
Mon Jul 25 16:35:27 CEST 2005



> -----Original Message-----
> From: nagios-users-admin at lists.sourceforge.net [mailto:nagios-users-
> admin at lists.sourceforge.net] On Behalf Of Ralph.Grothe at itdz-berlin.de
> Sent: Monday, July 25, 2005 8:09 AM
> To: nagios-users at lists.sourceforge.net
> Subject: [Nagios-users] FW: Howto replace epoch secs in nagios.log by
> human readable date ?
> 
> Sorry for the mispost.
> Of course I meant to send it to nagios-users.
> 
> -----Original Message-----
> From: Grothe, Ralph
> Sent: Monday, July 25, 2005 3:05 PM
> To: Nagiosplug-Help-Admin (E-Mail)
> Subject: Howto replace epoch secs in nagios.log by human readable
> date?
> 
> 
> Hi,
> 
> after some major configuration changes I sent nagios a sighup.
> 
> To check if it got caught I had a look at nagios.log.
> 
> Then I realized that it is rather inconvenient to always having
> to do some conversion like such
> to find out when messages got written.
> 
> [nagios at daisy:~/etc]
> $ perl -anle 'print scalar localtime(($F[0]=~/(\d+)/)[0]) if eof'
> /var/opt/nagios/log/nagios.log
> Mon Jul 25 14:53:37 2005
> 

http://www.nagios.org/faqs/viewfaq.php?faq_id=70

Modifying that slightly, 

tail -f nagios.log  | perl -pe 's/(\d+)/localtime($1)/e'

works quite well as an alias.

> 
> I'm sure one can select a custom (or common logfile format)
> similar to Apache.
> Can one?

One cannot.

--
Marc


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list