When you have a (big) log file, and you need to know which minutes generated the most lines, you can use a GQL query like this:
FxGqlC> select top 100 left($line, 16), count(1) into [logfile_linespermin.txt] from [logfile.txt] group by left($line, 16) order by 2 desc
In this example, the first 16 characters of every line contain the date and time up till the minutes.
When the date/time is somewhere in the middle of the line, a regular expression can be used:
FxGqlC> select top 100 matchregex($line, '(\d{4}-\d{2}-\d{2} \d{2}\:\d{2})\:\d{2}'), count(1) into [logfile_linespermin.txt] from [logfile.txt] group by matchregex($line, '(\d{4}-\d{2}-\d{2} \d{2}\:\d{2})\:\d{2}') order by 2 desc
And if you need to get the total number of lines per minute, totaled over all the hours, you can run:
FxGqlC> select matchregex($line, '\d{4}-\d{2}-\d{2} \d{2}\:(\d{2})\:\d{2}'), count(1) into [logfile_linespermin.txt] from [logfile.txt] group by matchregex($line, '\d{4}-\d{2}-\d{2} \d{2}\:(\d{2})\:\d{2}') order by 2 desc
More information on: https://sites.google.com/site/fxgqlc
Nenhum comentário:
Postar um comentário