Nerd blog.

05 Sep 2015

Nagios Logs, Handy One-Liner

Nagios is an amazing network monitoring tool, and its logs are a greppable goldmine of information. Most of us aren’t able to convert timestamps into local dates on the fly. GeekPeek offers the following one-liner which you can add into a pipe to convert timestamps into human-readable format on the fly.

perl -pe 's/(\d+)/localtime($1)/e'

I’ve used variations on this to convert the timestamps of BGP advertisements in JSON objects outputted from exabgp. It is a very handy chunk of a one-liner to keep handy.

External References

Theodore Baschak - Theo is a network engineer with experience operating core internet technologies like HTTP, HTTPS and DNS. He has extensive experience running service provider networks with OSPF, MPLS, and BGP.