Theodore Baschak

Routing Guru. IPv6 Advocate. Operator of Hextet Systems (AS395089).

Nagios Logs, Handy One-Liner

Sat, 05 Sep 2015 18:25:11 -0500 » Nerd Projects, Nagios, Network Monitoring, CLI, Programming, Networking, System Administration » Estimated read time: 1 min

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.