Looking for a method to take a raw log file and format it into HTML
Posted on 2003-11-06
My question is, I would like to find a way to take a log file on a unix server and have a script that parses that log file and pipes it into HTML for easier viewing. The format that the log file takes currently looks like this:
servername MEMORY.MEMORY.MEMPageFreed ALARM:value=285 at 11/04/2003 13:17:23 -- cse1
servername MEMORY.MEMORY.MEMPageFreed WARN:value=86 at 11/04/2003 13:18:06 -- cse1
servername FILESYSTEM.root.FSCapacity ALARM:value=96 at 11/04/2003 13:18:30 -- ucse1
servername FILESYSTEM.stage.FSCapacity ALARM:value=98 at 11/04/2003 13:18:26 -- cse1
The log file entries above (4 separate ones) detail when a certain threshold is reached for a server parameter, for example when a filesystem breaches 95%. The log file is generated from an application called Patrol which monitors all systems for a multitude of paramaters and warns or alarms when they reach certain values. Not to get off the subject anymore than that, is there a way to read that file and output it to HTML on that server?
To slightly complicate things, these values are generated in real-time, could be written to the log in a matter of seconds or minutes, depending on if a value is reached. Therefore, the script would need to somehow continually read from the file or be activated when the log file is updated somehow.
Would it also be possible to parse the file in such a way that only the lines in the file where the value amount is, say, greater than 95 for example be viewable in the report? I am a real beginner with Perl programming and programming in general so any help on this would be greatly appreciated.