version 1.1, 2014/03/20 15:11:24
|
version 1.2, 2014/11/08 19:41:03
|
|
|
## the various OOP processes (Each process generates a separate log file) | ## the various OOP processes (Each process generates a separate log file) |
## into a single log file sorted by time. | ## into a single log file sorted by time. |
## It consolidates multiple line log records into single line records for | ## It consolidates multiple line log records into single line records for |
## the sort process and maps the time from the format seconds and microseconds |
## the sort process and maps the time from the original trace format |
## to a decimal number of fixed length for the subsequent sort. |
## for subsequent sort. |
| |
## It produces an output of the records from all input trace files consolidated | ## It produces an output of the records from all input trace files consolidated |
## into a single output stream to standard output | ## into a single output stream to standard output |
| |
## awk -f consolidateTrace.awk [input file list] >outputfile | ## awk -f consolidateTrace.awk [input file list] >outputfile |
| |
|
## |
## This script substitutes for the EOL character in those lines where | ## This script substitutes for the EOL character in those lines where |
## the EOL does not represent a complete record for the input files and | ## the EOL does not represent a complete record for the input files and |
## outputs the result to a temp output file the substitution is defined in | ## outputs the result to a temp output file the substitution is defined in |
## localRS below |
## localRS below. This is to ensure that multiline trace elements (ex. |
|
## the XML output) gets sorted as a single entity. |
| |
## Consolidate the current line and the record accumulator if it exists |
|
## and output the result to the std ouput |
|
BEGIN { | BEGIN { |
accum = "" | accum = "" |
## local record separator. NOTE: This may be to simplistic since we | ## local record separator. NOTE: This may be to simplistic since we |
|
|
namesFile = "FileNames.txt" | namesFile = "FileNames.txt" |
} | } |
| |
## This line is not a complete log record. Time field not correct |
## This line is not a complete log record, time field not correct |
## add the current record to the record accumulator with the localRS | ## add the current record to the record accumulator with the localRS |
## (Record Separator) since this is a multiline log record (i.e. no time as | ## (Record Separator) since this is a multiline log record (i.e. no time as |
## first field) | ## first field) |
|
|
accum = accum LocalRS $0 | accum = accum LocalRS $0 |
} | } |
| |
## for all trace records (i.e. with time), accumulate everything until the next |
## For all trace records (i.e. with time), accumulate everything until the next |
## trace record in an accumulator record. Also map to a fixed length output | ## trace record in an accumulator record. Also map to a fixed length output |
## for the time field so that it sorts properly. This is because the | ## for the time field so that it sorts properly. This is because the |
## microseconds part today is variable length (i.e. number of microseconds | ## microseconds part today is variable length (i.e. number of microseconds |
|
|
| |
## output the array of process IDs vs filenames into a file for later use. | ## output the array of process IDs vs filenames into a file for later use. |
END { | END { |
#### print "" > namesFile |
|
cmd="rm -f " namesFile |
|
system(cmd) |
|
for (id in filenameArray) | for (id in filenameArray) |
{ | { |
print item, filenameArray[id] >> namesFile |
print id, filenameArray[id] >> namesFile |
} | } |
} | } |
| |