Change timestamp in nagios logfiles to readable dates

For everybody how has worked with Nagios; it logs (/var/log/nagios.log) the date in a timestamp! Quite annoying so here is how to convert it to a normal date format:

cat /var/nagios/nagios.log | while read date rest ; do timestamp=$(echo $date | sed 's/\[//;s/\]//'); echo $(date -d @$timestamp) $rest ; done

About Consultancy Articles Contact

References Red Hat Certified Architect By Robert de Bock Robert de Bock
Curriculum Vitae By Fred Clausen +31 6 14 39 58 72
By Nelson Manning