mirror of
https://github.com/zeek/zeek.git
synced 2025-10-05 08:08:19 +00:00
Large update for the SumStats framework.
- On-demand access to sumstats results through "return from" functions named SumStats::request and Sumstats::request_key. Both functions are tested in standalone and clustered modes. - $name field has returned to SumStats which simplifies cluster code and makes the on-demand access stuff possible. - Clustered results can only be collected for 1 minute from their time of creation now instead of time of last read. - Thresholds use doubles instead of counts everywhere now. - Calculation dependency resolution occurs at start up time now instead of doing it at observation time which provide a minor cpu performance improvement. A new plugin registration mechanism was created to support this change. - AppStats now has a minimal doc string and is broken into hook-based plugins. - AppStats and traceroute detection added to local.bro
This commit is contained in:
parent
7d7d30e1f7
commit
bec965b66f
34 changed files with 687 additions and 277 deletions
6
scripts/policy/misc/app-stats/plugins/__load__.bro
Normal file
6
scripts/policy/misc/app-stats/plugins/__load__.bro
Normal file
|
@ -0,0 +1,6 @@
|
|||
@load ./facebook
|
||||
@load ./gmail
|
||||
@load ./google
|
||||
@load ./netflix
|
||||
@load ./pandora
|
||||
@load ./youtube
|
12
scripts/policy/misc/app-stats/plugins/facebook.bro
Normal file
12
scripts/policy/misc/app-stats/plugins/facebook.bro
Normal file
|
@ -0,0 +1,12 @@
|
|||
@load ../main
|
||||
|
||||
module AppStats;
|
||||
|
||||
hook add_sumstats(id: conn_id, hostname: string, size: count)
|
||||
{
|
||||
if ( /\.(facebook\.com|fbcdn\.net)$/ in hostname && size > 20 )
|
||||
{
|
||||
SumStats::observe("apps.bytes", [$str="facebook"], [$num=size]);
|
||||
SumStats::observe("apps.hits", [$str="facebook"], [$str=cat(id$orig_h)]);
|
||||
}
|
||||
}
|
12
scripts/policy/misc/app-stats/plugins/gmail.bro
Normal file
12
scripts/policy/misc/app-stats/plugins/gmail.bro
Normal file
|
@ -0,0 +1,12 @@
|
|||
@load ../main
|
||||
|
||||
module AppStats;
|
||||
|
||||
hook add_sumstats(id: conn_id, hostname: string, size: count)
|
||||
{
|
||||
if ( /\.gmail\.com$/ in hostname && size > 20 )
|
||||
{
|
||||
SumStats::observe("apps.bytes", [$str="gmail"], [$num=size]);
|
||||
SumStats::observe("apps.hits", [$str="gmail"], [$str=cat(id$orig_h)]);
|
||||
}
|
||||
}
|
12
scripts/policy/misc/app-stats/plugins/google.bro
Normal file
12
scripts/policy/misc/app-stats/plugins/google.bro
Normal file
|
@ -0,0 +1,12 @@
|
|||
@load ../main
|
||||
|
||||
module AppStats;
|
||||
|
||||
hook add_sumstats(id: conn_id, hostname: string, size: count)
|
||||
{
|
||||
if ( /\.google\.com$/ in hostname && size > 20 )
|
||||
{
|
||||
SumStats::observe("apps.bytes", [$str="google"], [$num=size]);
|
||||
SumStats::observe("apps.hits", [$str="google"], [$str=cat(id$orig_h)]);
|
||||
}
|
||||
}
|
12
scripts/policy/misc/app-stats/plugins/netflix.bro
Normal file
12
scripts/policy/misc/app-stats/plugins/netflix.bro
Normal file
|
@ -0,0 +1,12 @@
|
|||
@load ../main
|
||||
|
||||
module AppStats;
|
||||
|
||||
hook add_sumstats(id: conn_id, hostname: string, size: count)
|
||||
{
|
||||
if ( /\.nflximg\.com$/ in hostname && size > 200*1024 )
|
||||
{
|
||||
SumStats::observe("apps.bytes", [$str="netflix"], [$num=size]);
|
||||
SumStats::observe("apps.hits", [$str="netflix"], [$str=cat(id$orig_h)]);
|
||||
}
|
||||
}
|
12
scripts/policy/misc/app-stats/plugins/pandora.bro
Normal file
12
scripts/policy/misc/app-stats/plugins/pandora.bro
Normal file
|
@ -0,0 +1,12 @@
|
|||
@load ../main
|
||||
|
||||
module AppStats;
|
||||
|
||||
hook add_sumstats(id: conn_id, hostname: string, size: count)
|
||||
{
|
||||
if ( /\.(pandora|p-cdn)\.com$/ in hostname && size > 512*1024 )
|
||||
{
|
||||
SumStats::observe("apps.bytes", [$str="pandora"], [$num=size]);
|
||||
SumStats::observe("apps.hits", [$str="pandora"], [$str=cat(id$orig_h)]);
|
||||
}
|
||||
}
|
12
scripts/policy/misc/app-stats/plugins/youtube.bro
Normal file
12
scripts/policy/misc/app-stats/plugins/youtube.bro
Normal file
|
@ -0,0 +1,12 @@
|
|||
@load ../main
|
||||
|
||||
module AppStats;
|
||||
|
||||
hook add_sumstats(id: conn_id, hostname: string, size: count)
|
||||
{
|
||||
if ( /\.youtube\.com$/ in hostname && size > 512*1024 )
|
||||
{
|
||||
SumStats::observe("apps.bytes", [$str="youtube"], [$num=size]);
|
||||
SumStats::observe("apps.hits", [$str="youtube"], [$str=cat(id$orig_h)]);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue