Permanently change Logfile to human Readable

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
ericssonvietnam
Posts: 239
Joined: Mon Jun 27, 2016 11:05 pm

Permanently change Logfile to human Readable

Post 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)
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Permanently change Logfile to human Readable

Post 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
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked