mirror of
https://github.com/zeek/zeek.git
synced 2025-10-17 14:08:20 +00:00
topk for sumstats
This commit is contained in:
parent
5da97455f5
commit
de5769a88f
10 changed files with 198 additions and 4 deletions
24
scripts/base/frameworks/sumstats/plugins/topk.bro
Normal file
24
scripts/base/frameworks/sumstats/plugins/topk.bro
Normal file
|
@ -0,0 +1,24 @@
|
|||
@load base/frameworks/sumstats
|
||||
|
||||
module SumStats;
|
||||
|
||||
export {
|
||||
redef enum Calculation += {
|
||||
TOPK
|
||||
};
|
||||
|
||||
redef record ResultVal += {
|
||||
topk: opaque of topk &default=topk_init(500);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
hook observe_hook(r: Reducer, val: double, obs: Observation, rv: ResultVal)
|
||||
{
|
||||
if ( TOPK in r$apply )
|
||||
{
|
||||
topk_add(rv$topk, obs);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue