Skip to content

Convert UNIX timestamps to readable dates while viewing logfiles

As many admins know, logfiles are a cool thing. That is, if they are readable. Take for example the log written by Nagios.

$ grep restarting nagios.log 
[1423469372] Caught SIGHUP, restarting... 
[1423486879] Caught SIGHUP, restarting...

If you want to know the time of the restarts, you must convert the timestamps to a readable time. The Swiss-army-knife Perl and some RegEx know-how can do this easily.

$ grep restarting nagios.log | perl -pe 's/(\d+)/localtime($1)/e'
[Mon Feb  9 09:09:32 2015] Caught SIGHUP, restarting...
[Mon Feb  9 14:01:19 2015] Caught SIGHUP, restarting...

I/O tuning for Nagios

Since the setup of our new Nagios Cluster (based on Linux-HA and DRBD) I hat a slight discomfort looking at the Network and Disk I/O rates of the System. We had about 10MBit/s network traffic between the Nodes. I was almost sure it was caused by DRBD, since Nagios generates many Files.

Yesterday I had some time for tuning our systems. After a bit of looking around I moved some files and the network and disk I/O usage dropped by roughly 70%!

"I/O tuning for Nagios" vollständig lesen