-1

here are sample lines

Apr  9 11:53:26 skip [2244]: [2244] ab-cd-ef:cc [INFO] A recoverable error has occurred
some other log lines ..
....
Apr  9 12:53:26 skip [2244]: [2244] ab-cd-ef:cc [INFO] A recoverable error has occurred

now the LATEST line would have to be one with the latest Date String, and THAT is the one that needs to be printed, plus the NEXT time the parser runs on the log file, somehow the previous LATEST line has to be compared with the Existing latest one, and it CAN e the case, that NOTHING Changed and the OLD line is STILL the latest one, OR there is a NEW line, but ONLY the NEW log line should be printed and NOT if there is NO NEW log Entry.

Jordan Running
  • 102,619
  • 17
  • 182
  • 182
kamal
  • 9,637
  • 30
  • 101
  • 168

1 Answers1

0

Assuming typical logfile always log the info in sequential time order where the latest data will always printout later in the file, then you can just iterate over your logfile and put your info in Hash/associated array with the log string as key and the log timestamp as entry.

By the time you finish with the file, the entry should contain the last time the wanted log info was printed.

DJ.
  • 6,664
  • 1
  • 33
  • 48