Systemtime in Nagios logs to human readable timestamps

Normally Nagios logs it's command in Unix time so results from checks looks like this:

[1401179967] EXTERNAL COMMAND: SCHEDULE_FORCED_SVC_CHECK;vsphere;DISK SPACE;1401179966
[1401179967] SERVICE ALERT: vsphere;DISK SPACE;OK;SOFT;2;C:\ Label:  Serial Number ac56519b: 59%used(12035MB/20466MB) (<90%) : OK
[1401179986] EXTERNAL COMMAND: ENABLE_SVC_NOTIFICATIONS;vsphere;DISK SPACE

However this can be converted with a simple Perl script to a "normal" time/date format:

# perl -pe 's/(\d+)/localtime($1)/e' /var/log/nagios/nagios.log (or whatever your path is)

The result is now this:

[Tue May 27 10:39:27 2014] EXTERNAL COMMAND: SCHEDULE_FORCED_SVC_CHECK;vsphere;DISK SPACE;1401179966
[Tue May 27 10:39:27 2014] SERVICE ALERT: vsphere;DISK SPACE;OK;SOFT;2;C:\ Label:  Serial Number ac56519b: 59%used(12035MB/20466MB) (<90%) : OK
[Tue May 27 10:39:46 2014] EXTERNAL COMMAND: ENABLE_SVC_NOTIFICATIONS;vsphere;DISK SPACE

Try it out :-)