I know I should learn more bash programming and I want to and I will but right now, I'm somewhat ashamed to admit that I need help and
haven't got the time to learn what I need to know.
so, my problem:
I have an application that outputs a log file (rotated daily) of the format:
17-Apr-2006 20:16:28 [proc1] [INFO ] [mainapp] 15845 Request: xxx.xxx.xxx.xxx
17-Apr-2006 20:16:28 [proc1] [INFO ] [mainapp] 15845 Info: blah/blah1/blah2/blah3
17-Apr-2006 20:16:29 [proc1] [INFO ] [mainapp] 15845 Response: 00000000000000000000000000005Ev2 - OK blah/blah1/blah2/blah3
Each successful process on my application results in a set of three lines of code that go into /logs/blah.log, each set of three log entries is linked by the id number, in this case 15845 (names, processes and etc changed to protect the innocent and copyrighted..). However, sometimes my application crashes and in that circumstance, it only writes lines 1 and 2.
I need a script that will tail, say, the last 50 lines of the file, check that
how the script does this, I dont know.
maybe it will get the order number from the file through grep/awk then grep the log file for that order number (surrounded by spaces) and pipe it through "wc -l" (but this would have a problem if the system was in the middle of processing something and was half way through a set of "three log entries").
any ideas please?
thanks v much for any help offered.