Page 1 of 1

Permanently change Logfile to human Readable

Posted: Tue Apr 10, 2018 1:39 am
by ericssonvietnam
By default the logs are in unix time stamp is it possible to save the logs in human readable format so that i do not have to user any command to convert the /usr/local/nagios/var/nagios.log in human readable format.
Current Format
[1523298600] CURRENT HOST STATE: APSDP35A-10.106.62.9;UP;HARD;1;PING OK - Packet loss = 0%, RTA = 29.31 ms
[1523298600] CURRENT HOST STATE: APSDP35B-10.106.62.10;UP;HARD;1;PING OK - Packet loss = 0%, RTA = 30.70 ms
[1523298600] CURRENT HOST STATE: APSDP36A-10.106.62.14;UP;HARD;1;PING OK - Packet loss = 0%, RTA = 29.26 ms
[1523298600] CURRENT HOST STATE: APSDP36B-10.106.62.15;UP;HARD;1;PING OK - Packet loss = 0%, RTA = 30.11 ms

Required format
[Tue Apr 10 12:09:17 2018] SERVICE ALERT: UE_HAZ_AP2-10.34.1.27;Service SSH Check;OK;SOFT;2;SSH OK - OpenSSH_3.9p1 (protocol 2.0)
[Tue Apr 10 12:09:17 2018] SERVICE ALERT: BH_BHA4_AP2-10.137.72.67;Service SSH Check;OK;SOFT;2;SSH OK - OpenSSH_3.9p1 (protocol 2.0)

Re: Permanently change Logfile to human Readable

Posted: Tue Apr 10, 2018 8:44 am
by scottwilkerson
This is not possible because the nagios cgi's need to use the data in the nagios.log as well as the archives and expects it is a specific format