mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Weird settings: make constants into options.
The new weird settings are now all updateable during runtime.
This commit is contained in:
parent
5c68093bc3
commit
bec98b98f3
9 changed files with 675 additions and 12 deletions
|
@ -1,2 +1,3 @@
|
|||
@load ./main
|
||||
@load ./input
|
||||
@load ./weird
|
||||
|
|
44
scripts/base/frameworks/config/weird.bro
Normal file
44
scripts/base/frameworks/config/weird.bro
Normal file
|
@ -0,0 +1,44 @@
|
|||
##! This script sets up the config framework change handlers for weirds.
|
||||
|
||||
@load ./main
|
||||
|
||||
module Config;
|
||||
|
||||
function weird_option_change_sampling_whitelist(ID: string, new_value: string_set, location: string) : string_set
|
||||
{
|
||||
if ( ID == "Weird::sampling_whitelist" )
|
||||
{
|
||||
Reporter::set_weird_sampling_whitelist(new_value);
|
||||
}
|
||||
return new_value;
|
||||
}
|
||||
|
||||
function weird_option_change_count(ID: string, new_value: count, location: string) : count
|
||||
{
|
||||
if ( ID == "Weird::sampling_threshold" )
|
||||
{
|
||||
Reporter::set_weird_sampling_threshold(new_value);
|
||||
}
|
||||
else if ( ID == "Weird::sampling_rate" )
|
||||
{
|
||||
Reporter::set_weird_sampling_rate(new_value);
|
||||
}
|
||||
return new_value;
|
||||
}
|
||||
|
||||
function weird_option_change_interval(ID: string, new_value: interval, location: string) : interval
|
||||
{
|
||||
if ( ID == "Weird::sampling_duration" )
|
||||
{
|
||||
Reporter::set_weird_sampling_duration(new_value);
|
||||
}
|
||||
return new_value;
|
||||
}
|
||||
|
||||
event bro_init() &priority=5
|
||||
{
|
||||
Option::set_change_handler("Weird::sampling_whitelist", weird_option_change_sampling_whitelist, 5);
|
||||
Option::set_change_handler("Weird::sampling_threshold", weird_option_change_count, 5);
|
||||
Option::set_change_handler("Weird::sampling_rate", weird_option_change_count, 5);
|
||||
Option::set_change_handler("Weird::sampling_duration", weird_option_change_interval, 5);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue