we have a temporary fix for the hotspot data
This commit is contained in:
parent
e1601ca869
commit
568d06cd84
5 changed files with 304 additions and 0 deletions
40
roles/web-data-analysis/files/hotspot-data.awk
Normal file
40
roles/web-data-analysis/files/hotspot-data.awk
Normal file
|
@ -0,0 +1,40 @@
|
|||
BEGIN{
|
||||
date=strftime("%F",0);
|
||||
count=1;
|
||||
sum=0;
|
||||
most=0;
|
||||
least=0
|
||||
}
|
||||
|
||||
{
|
||||
newdate=strftime("%F",$1); # convert this to a printable date
|
||||
if (date == strftime("%F",0)){ # we hit a min time and need to just print same stuff.
|
||||
print date ",AVG,LEAST,MAX"
|
||||
date=newdate;
|
||||
count=1; # start count to 0. we should have 288 per day but logs are stupid
|
||||
sum=$2; # start the sum
|
||||
most=$2; # what is going to be our most per day
|
||||
least=$2; # what is going to be our least per day
|
||||
} else {
|
||||
if (date != newdate){
|
||||
print date "," int(sum/count) "," least "," most;
|
||||
date=newdate;
|
||||
count=1; # start count to 0. we should have 288 per day but logs are stupid
|
||||
sum=$2; # start the sum
|
||||
most=$2; # what is going to be our most per day
|
||||
least=$2; # what is going to be our least per day
|
||||
} else {
|
||||
count=count+1;
|
||||
sum=sum+$2;
|
||||
if ($2 > most){
|
||||
most=$2;
|
||||
};
|
||||
if ($2 < least) {
|
||||
least=$2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
END{
|
||||
print date "," int(sum/count) "," least "," most;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue