I have managed to code the script.
I am having troubles creating wiki account (not Zimbra fault but mine). When I'm able to create it I will update the page's discussion so that someone hopefully includes the script in the official page.
Here there is how you run the script:
Code:
cat access_log.2012-02-06 | awk -F ' ' '{print $4}' | awk -f access_log.awk .
And here there is the access_log.awk file contents:
Code:
BEGIN {
FS=":"
Peak = 1
CurrentPeak = 0
oldVar=""
}
{
#printf ("Linea: %s\n", $0)
hour = $2
minute = $3
second = $4
#printf("hour: %s, minute: %s, second: %s\n",hour,minute,second)
currentVar = hour minute second
#printf ("currentVar definido: %s\n", currentVar)
#printf ("oldVar definido: %s\n", oldVar)
if ( currentVar == oldVar )
{
#printf ("1Current var vale: %s\n",currentVar)
#print "CurrentVar es igual que oldVar"
CurrentPeak ++
if ( CurrentPeak > Peak)
{
Peak = CurrentPeak
PeakLine = $0
}
} else
{
#printf ("2Current var vale: %s\n",currentVar)
#print "CurrentVar es DIFERENTE de oldVar"
CurrentPeak = 1
}
oldVar=currentVar
}
END {
print "Peak per second is: " Peak
print "Latest Peak line is: " PeakLine
}