Page 1 of 1

Is this possible with textpad

Posted: Sat Feb 20, 2010 6:22 pm
by geoffgin
Hello,

I'm trying to simplify log parsing

I'm trying to grep thorugh multiple logs (txt's)for a number of errors, so that i don't have to do multiple searches. I'm also hoping to sort and organize the data that is collected in defirrent ways. I will be pointing to say a week worth of logs from multiple severs. The machine may have several instances of the application running on it as well.

Example of log folder structure

Logs
Server1
date1
date2
Server2
date1
date2

Example Search string:

81002746\|80040111

Example Log lines

Sname Aname EventId Time and Date ThreadId Value
Server1 App1 [20717] (02/16 10:44:49.406):{0x3448} Error (81002746)
Server1 App2 [30002] (02/16 10:45:06.430):{0x2550} Error (80040111)
Server1 App1 [20717] (02/17 10:44:49.406):{0x3338} Error (81002746)
Server1 App2 [30002] (02/17 10:45:06.430):{0x2AE0} Error (80040111)
Server2 App1 [30002] (02/16 10:45:06.430):{0x2550} Error (80040111)
Server2 App2 [20717] (02/16 10:44:49.406):{0x3338} Error (81002746)
Server2 App1 [30002] (02/17 10:45:06.430):{0x2AE0} Error (80040111)
Server2 App2 [20717] (02/17 10:44:49.406):{0x3448} Error (81002746)

I was hoping to first organize like the example below.

Example of the output of a grep I'm hoping for:

GreppedLogs
Server1
0216
Server1 App1 [20717] (02/16 10:44:49.406):{0x3448} Error (81002746)
Server1 App2 [30002] (02/16 10:45:06.430):{0x2550} Error (80040111)
0217
Server1 App1 [20717] (02/17 10:44:49.406):{0x3338} Error (81002746)
Server1 App2 [30002] (02/17 10:45:06.430):{0x2AE0} Error (80040111)

Server2
0216
Server2 App1 [30002] (02/16 10:45:06.430):{0x2550} Error (80040111)
Server2 App2 [20717] (02/16 10:44:49.406):{0x3338} Error (81002746)
0216
Server2 App1 [30002] (02/17 10:45:06.430):{0x2AE0} Error (80040111)
Server2 App2 [20717] (02/17 10:44:49.406):{0x3448} Error (81002746)

Within each log

sorting firts by thread then by error

Example of a file that i'm hoping for

Server2 App2 [20717] (02/17 10:44:49.406):{0x3448} Error (80040111)
Server2 App2 [20717] (02/17 10:44:49.406):{0x3448} Error (81002746)
Server2 App2 [20717] (02/17 10:44:49.406):{0x3448} Error (81002746)
Server2 App1 [30002] (02/17 10:45:06.430):{0x2AE0} Error (80040111)
Server2 App1 [30002] (02/17 10:45:06.430):{0x2AE0} Error (80040111)
Server2 App1 [30002] (02/17 10:45:06.430):{0x2AE0} Error (81002746)

I don't mind investing a little time in a process to do this but don't want to waiste my time if its not possible. if it is possible I would appreciate any help i can get.

Posted: Mon Feb 22, 2010 10:14 pm
by kengrubb
Well, it certainly is possible with TextPad using Search, Find in Files ... to look for strings or REs.

One can search certain filename patterns and search the subfolders beneath the folder where you're searching.

However, if you're looking to then sort the output and serve it up, then I'm afraid TextPad alone won't be enough. You'll have to invest in scripting.

Posted: Tue Feb 23, 2010 4:08 am
by Bob Hansen
I think that what you want to do may be possible with TextPad and TextPad macros. The major limitation will be that the macro cannot be edited, so the steps must be perfectly worked out and documented in advance..

You first need to use RegEx to rearrange the data to do the proper sorting. The sorting rules are not totally clear to me from your sample, I seem to see some "ties".
Then you can use RegEx to rearrange/parse the data and insert the correct headings.

You may also need some batch files defined as tools to do the folder work that is needed. Macros use hard coded folder/filenames, so you may need to use batch files to do some file renaming/moving first.

You may actually used one macro to call another one. Some will be doing parsing, others may be inserting headings/footer labels.

Posted: Wed Feb 24, 2010 10:30 pm
by kengrubb
Bob,

You walk much thinner wires between much taller buildings than I normally consider.

:wink: