I have a log that registers search queries with the following format:
_time q MAC
11/13/12 12:46:31.000 AM CA 0000000B4BE8
11/13/12 12:46:31.200 AM CARL 0000000B4BE8
11/13/12 12:46:31.250 AM CARLIE 0000000B4BE8
11/13/12 12:46:31.255 AM CARLIE B 0000000B4BE8
11/13/12 12:46:31.270 AM CARLIE BR 0000000B4BE8
11/13/12 12:46:32.100 AM CHAR 0000000B4BE8
11/13/12 12:46:32.150 AM CHARL 0000000B4BE8
11/13/12 12:46:32.155 AM CHARLI 0000000B4BE8
11/13/12 12:46:32.223 AM CHARLIE 0000000B4BE8
11/13/12 12:46:32.354 AM CHARLIE B 0000000B4BE8
11/13/12 12:46:33.400 AM CHARLIE BR 0000000B4BE8
The result set I need should be:
MAC count q
0000000B4BE8 5 CARLIE BR
0000000B4BE8 6 CHARLIE BR
The recommended query found in below answer is the following:
search construct|
| stats count by q, MAC
| eval len=length(q)
| eventstats max(len) AS longest by MAC| where len=longest
| table MAC q count
The query does not returned the distinct longest q. If this query is ran against the sample log presented before the result set is:
MAC count q
0000000B4BE8 6 CHARLIE BR
It should be:
MAC count q
0000000B4BE8 5 CARLIE BR
0000000B4BE8 6 CHARLIE BR
Any ideas? How to fix it.
Thanks,
Lp
... View more