mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 23:58:20 +00:00
Merge remote-tracking branch 'origin/topic/seth/metrics-merge'
* origin/topic/seth/metrics-merge: (70 commits) Added protocol to the traceroute detection script. Added an automatic state limiter for threshold based SumStats. Removed some dead code in scan.bro Renamed a plugin hook in sumstats framework. Move loading variance back to where it should be alphabetically. Fix a bug with path building in FTP. Came up when changing the path utils. Fix a few tests. SumStats test checkpoint. SumStats tests pass. Checkpoint for SumStats rename. Fix another occasional reporter error. Small updates to hopefully correct reporter errors leading to lost memory. Trying to fix a state maintenance issue. Updating DocSourcesList Updated FTP bruteforce detection and a few other small changes. Test updates and cleanup. Fixed the measurement "sample" plugin. Fix path compression to include removing "/./". Removed the example metrics scripts. Better real world examples exist now. Measurement framework is ready for testing. ...
This commit is contained in:
commit
1e40a2f88c
62 changed files with 2388 additions and 1278 deletions
|
@ -3,7 +3,7 @@
|
|||
#empty_field (empty)
|
||||
#unset_field -
|
||||
#path loaded_scripts
|
||||
#open 2012-07-20-14-34-11
|
||||
#open 2013-04-02-04-24-03
|
||||
#fields name
|
||||
#types string
|
||||
scripts/base/init-bare.bro
|
||||
|
@ -14,20 +14,21 @@ scripts/base/init-bare.bro
|
|||
build/src/base/reporter.bif.bro
|
||||
build/src/base/event.bif.bro
|
||||
scripts/base/frameworks/logging/__load__.bro
|
||||
scripts/base/frameworks/logging/./main.bro
|
||||
scripts/base/frameworks/logging/main.bro
|
||||
build/src/base/logging.bif.bro
|
||||
scripts/base/frameworks/logging/./postprocessors/__load__.bro
|
||||
scripts/base/frameworks/logging/./postprocessors/./scp.bro
|
||||
scripts/base/frameworks/logging/./postprocessors/./sftp.bro
|
||||
scripts/base/frameworks/logging/./writers/ascii.bro
|
||||
scripts/base/frameworks/logging/./writers/dataseries.bro
|
||||
scripts/base/frameworks/logging/./writers/elasticsearch.bro
|
||||
scripts/base/frameworks/logging/./writers/none.bro
|
||||
scripts/base/frameworks/logging/postprocessors/__load__.bro
|
||||
scripts/base/frameworks/logging/postprocessors/scp.bro
|
||||
scripts/base/frameworks/logging/postprocessors/sftp.bro
|
||||
scripts/base/frameworks/logging/writers/ascii.bro
|
||||
scripts/base/frameworks/logging/writers/dataseries.bro
|
||||
scripts/base/frameworks/logging/writers/elasticsearch.bro
|
||||
scripts/base/frameworks/logging/writers/none.bro
|
||||
scripts/base/frameworks/input/__load__.bro
|
||||
scripts/base/frameworks/input/./main.bro
|
||||
scripts/base/frameworks/input/main.bro
|
||||
build/src/base/input.bif.bro
|
||||
scripts/base/frameworks/input/./readers/ascii.bro
|
||||
scripts/base/frameworks/input/./readers/raw.bro
|
||||
scripts/base/frameworks/input/./readers/benchmark.bro
|
||||
scripts/base/frameworks/input/readers/ascii.bro
|
||||
scripts/base/frameworks/input/readers/raw.bro
|
||||
scripts/base/frameworks/input/readers/benchmark.bro
|
||||
scripts/policy/misc/loaded-scripts.bro
|
||||
#close 2012-07-20-14-34-11
|
||||
scripts/base/utils/paths.bro
|
||||
#close 2013-04-02-04-24-03
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#empty_field (empty)
|
||||
#unset_field -
|
||||
#path loaded_scripts
|
||||
#open 2013-02-11-18-44-43
|
||||
#open 2013-04-22-18-02-50
|
||||
#fields name
|
||||
#types string
|
||||
scripts/base/init-bare.bro
|
||||
|
@ -14,109 +14,120 @@ scripts/base/init-bare.bro
|
|||
build/src/base/reporter.bif.bro
|
||||
build/src/base/event.bif.bro
|
||||
scripts/base/frameworks/logging/__load__.bro
|
||||
scripts/base/frameworks/logging/./main.bro
|
||||
scripts/base/frameworks/logging/main.bro
|
||||
build/src/base/logging.bif.bro
|
||||
scripts/base/frameworks/logging/./postprocessors/__load__.bro
|
||||
scripts/base/frameworks/logging/./postprocessors/./scp.bro
|
||||
scripts/base/frameworks/logging/./postprocessors/./sftp.bro
|
||||
scripts/base/frameworks/logging/./writers/ascii.bro
|
||||
scripts/base/frameworks/logging/./writers/dataseries.bro
|
||||
scripts/base/frameworks/logging/./writers/elasticsearch.bro
|
||||
scripts/base/frameworks/logging/./writers/none.bro
|
||||
scripts/base/frameworks/logging/postprocessors/__load__.bro
|
||||
scripts/base/frameworks/logging/postprocessors/scp.bro
|
||||
scripts/base/frameworks/logging/postprocessors/sftp.bro
|
||||
scripts/base/frameworks/logging/writers/ascii.bro
|
||||
scripts/base/frameworks/logging/writers/dataseries.bro
|
||||
scripts/base/frameworks/logging/writers/elasticsearch.bro
|
||||
scripts/base/frameworks/logging/writers/none.bro
|
||||
scripts/base/frameworks/input/__load__.bro
|
||||
scripts/base/frameworks/input/./main.bro
|
||||
scripts/base/frameworks/input/main.bro
|
||||
build/src/base/input.bif.bro
|
||||
scripts/base/frameworks/input/./readers/ascii.bro
|
||||
scripts/base/frameworks/input/./readers/raw.bro
|
||||
scripts/base/frameworks/input/./readers/benchmark.bro
|
||||
scripts/base/frameworks/input/readers/ascii.bro
|
||||
scripts/base/frameworks/input/readers/raw.bro
|
||||
scripts/base/frameworks/input/readers/benchmark.bro
|
||||
scripts/base/init-default.bro
|
||||
scripts/base/utils/site.bro
|
||||
scripts/base/utils/./patterns.bro
|
||||
scripts/base/utils/patterns.bro
|
||||
scripts/base/utils/addrs.bro
|
||||
scripts/base/utils/conn-ids.bro
|
||||
scripts/base/utils/directions-and-hosts.bro
|
||||
scripts/base/utils/files.bro
|
||||
scripts/base/utils/numbers.bro
|
||||
scripts/base/utils/paths.bro
|
||||
scripts/base/utils/queue.bro
|
||||
scripts/base/utils/strings.bro
|
||||
scripts/base/utils/thresholds.bro
|
||||
scripts/base/utils/time.bro
|
||||
scripts/base/utils/urls.bro
|
||||
scripts/base/frameworks/notice/__load__.bro
|
||||
scripts/base/frameworks/notice/./main.bro
|
||||
scripts/base/frameworks/notice/./weird.bro
|
||||
scripts/base/frameworks/notice/./actions/drop.bro
|
||||
scripts/base/frameworks/notice/./actions/email_admin.bro
|
||||
scripts/base/frameworks/notice/./actions/page.bro
|
||||
scripts/base/frameworks/notice/./actions/add-geodata.bro
|
||||
scripts/base/frameworks/notice/./extend-email/hostnames.bro
|
||||
scripts/base/frameworks/notice/main.bro
|
||||
scripts/base/frameworks/notice/weird.bro
|
||||
scripts/base/frameworks/notice/actions/drop.bro
|
||||
scripts/base/frameworks/notice/actions/email_admin.bro
|
||||
scripts/base/frameworks/notice/actions/page.bro
|
||||
scripts/base/frameworks/notice/actions/add-geodata.bro
|
||||
scripts/base/frameworks/notice/extend-email/hostnames.bro
|
||||
scripts/base/frameworks/cluster/__load__.bro
|
||||
scripts/base/frameworks/cluster/./main.bro
|
||||
scripts/base/frameworks/cluster/main.bro
|
||||
scripts/base/frameworks/control/__load__.bro
|
||||
scripts/base/frameworks/control/./main.bro
|
||||
scripts/base/frameworks/notice/./non-cluster.bro
|
||||
scripts/base/frameworks/notice/./actions/pp-alarms.bro
|
||||
scripts/base/frameworks/control/main.bro
|
||||
scripts/base/frameworks/notice/non-cluster.bro
|
||||
scripts/base/frameworks/notice/actions/pp-alarms.bro
|
||||
scripts/base/frameworks/dpd/__load__.bro
|
||||
scripts/base/frameworks/dpd/./main.bro
|
||||
scripts/base/frameworks/dpd/main.bro
|
||||
scripts/base/frameworks/signatures/__load__.bro
|
||||
scripts/base/frameworks/signatures/./main.bro
|
||||
scripts/base/frameworks/signatures/main.bro
|
||||
scripts/base/frameworks/packet-filter/__load__.bro
|
||||
scripts/base/frameworks/packet-filter/./main.bro
|
||||
scripts/base/frameworks/packet-filter/./netstats.bro
|
||||
scripts/base/frameworks/packet-filter/main.bro
|
||||
scripts/base/frameworks/packet-filter/netstats.bro
|
||||
scripts/base/frameworks/software/__load__.bro
|
||||
scripts/base/frameworks/software/./main.bro
|
||||
scripts/base/frameworks/software/main.bro
|
||||
scripts/base/frameworks/communication/__load__.bro
|
||||
scripts/base/frameworks/communication/./main.bro
|
||||
scripts/base/frameworks/metrics/__load__.bro
|
||||
scripts/base/frameworks/metrics/./main.bro
|
||||
scripts/base/frameworks/metrics/./non-cluster.bro
|
||||
scripts/base/frameworks/communication/main.bro
|
||||
scripts/base/frameworks/intel/__load__.bro
|
||||
scripts/base/frameworks/intel/./main.bro
|
||||
scripts/base/frameworks/intel/./input.bro
|
||||
scripts/base/frameworks/intel/main.bro
|
||||
scripts/base/frameworks/intel/input.bro
|
||||
scripts/base/frameworks/reporter/__load__.bro
|
||||
scripts/base/frameworks/reporter/./main.bro
|
||||
scripts/base/frameworks/reporter/main.bro
|
||||
scripts/base/frameworks/sumstats/__load__.bro
|
||||
scripts/base/frameworks/sumstats/main.bro
|
||||
scripts/base/frameworks/sumstats/plugins/__load__.bro
|
||||
scripts/base/frameworks/sumstats/plugins/average.bro
|
||||
scripts/base/frameworks/sumstats/plugins/max.bro
|
||||
scripts/base/frameworks/sumstats/plugins/min.bro
|
||||
scripts/base/frameworks/sumstats/plugins/sample.bro
|
||||
scripts/base/frameworks/sumstats/plugins/std-dev.bro
|
||||
scripts/base/frameworks/sumstats/plugins/variance.bro
|
||||
scripts/base/frameworks/sumstats/plugins/sum.bro
|
||||
scripts/base/frameworks/sumstats/plugins/unique.bro
|
||||
scripts/base/frameworks/sumstats/non-cluster.bro
|
||||
scripts/base/frameworks/tunnels/__load__.bro
|
||||
scripts/base/frameworks/tunnels/./main.bro
|
||||
scripts/base/frameworks/tunnels/main.bro
|
||||
scripts/base/protocols/conn/__load__.bro
|
||||
scripts/base/protocols/conn/./main.bro
|
||||
scripts/base/protocols/conn/./contents.bro
|
||||
scripts/base/protocols/conn/./inactivity.bro
|
||||
scripts/base/protocols/conn/./polling.bro
|
||||
scripts/base/protocols/conn/main.bro
|
||||
scripts/base/protocols/conn/contents.bro
|
||||
scripts/base/protocols/conn/inactivity.bro
|
||||
scripts/base/protocols/conn/polling.bro
|
||||
scripts/base/protocols/dns/__load__.bro
|
||||
scripts/base/protocols/dns/./consts.bro
|
||||
scripts/base/protocols/dns/./main.bro
|
||||
scripts/base/protocols/dns/consts.bro
|
||||
scripts/base/protocols/dns/main.bro
|
||||
scripts/base/protocols/ftp/__load__.bro
|
||||
scripts/base/protocols/ftp/./utils-commands.bro
|
||||
scripts/base/protocols/ftp/./main.bro
|
||||
scripts/base/protocols/ftp/./file-extract.bro
|
||||
scripts/base/protocols/ftp/./gridftp.bro
|
||||
scripts/base/protocols/ftp/utils-commands.bro
|
||||
scripts/base/protocols/ftp/main.bro
|
||||
scripts/base/protocols/ftp/file-extract.bro
|
||||
scripts/base/protocols/ftp/gridftp.bro
|
||||
scripts/base/protocols/ssl/__load__.bro
|
||||
scripts/base/protocols/ssl/./consts.bro
|
||||
scripts/base/protocols/ssl/./main.bro
|
||||
scripts/base/protocols/ssl/./mozilla-ca-list.bro
|
||||
scripts/base/protocols/ssl/consts.bro
|
||||
scripts/base/protocols/ssl/main.bro
|
||||
scripts/base/protocols/ssl/mozilla-ca-list.bro
|
||||
scripts/base/protocols/http/__load__.bro
|
||||
scripts/base/protocols/http/./main.bro
|
||||
scripts/base/protocols/http/./utils.bro
|
||||
scripts/base/protocols/http/./file-ident.bro
|
||||
scripts/base/protocols/http/./file-hash.bro
|
||||
scripts/base/protocols/http/./file-extract.bro
|
||||
scripts/base/protocols/http/main.bro
|
||||
scripts/base/protocols/http/utils.bro
|
||||
scripts/base/protocols/http/file-ident.bro
|
||||
scripts/base/protocols/http/file-hash.bro
|
||||
scripts/base/protocols/http/file-extract.bro
|
||||
scripts/base/protocols/irc/__load__.bro
|
||||
scripts/base/protocols/irc/./main.bro
|
||||
scripts/base/protocols/irc/./dcc-send.bro
|
||||
scripts/base/protocols/irc/main.bro
|
||||
scripts/base/protocols/irc/dcc-send.bro
|
||||
scripts/base/protocols/modbus/__load__.bro
|
||||
scripts/base/protocols/modbus/./consts.bro
|
||||
scripts/base/protocols/modbus/./main.bro
|
||||
scripts/base/protocols/modbus/consts.bro
|
||||
scripts/base/protocols/modbus/main.bro
|
||||
scripts/base/protocols/smtp/__load__.bro
|
||||
scripts/base/protocols/smtp/./main.bro
|
||||
scripts/base/protocols/smtp/./entities.bro
|
||||
scripts/base/protocols/smtp/./entities-excerpt.bro
|
||||
scripts/base/protocols/smtp/main.bro
|
||||
scripts/base/protocols/smtp/entities.bro
|
||||
scripts/base/protocols/smtp/entities-excerpt.bro
|
||||
scripts/base/protocols/socks/__load__.bro
|
||||
scripts/base/protocols/socks/./consts.bro
|
||||
scripts/base/protocols/socks/./main.bro
|
||||
scripts/base/protocols/socks/consts.bro
|
||||
scripts/base/protocols/socks/main.bro
|
||||
scripts/base/protocols/ssh/__load__.bro
|
||||
scripts/base/protocols/ssh/./main.bro
|
||||
scripts/base/protocols/ssh/main.bro
|
||||
scripts/base/protocols/syslog/__load__.bro
|
||||
scripts/base/protocols/syslog/./consts.bro
|
||||
scripts/base/protocols/syslog/./main.bro
|
||||
scripts/base/protocols/syslog/consts.bro
|
||||
scripts/base/protocols/syslog/main.bro
|
||||
scripts/base/misc/find-checksum-offloading.bro
|
||||
scripts/policy/misc/loaded-scripts.bro
|
||||
#close 2013-02-11-18-44-43
|
||||
#close 2013-04-22-18-02-50
|
||||
|
|
|
@ -3,5 +3,5 @@
|
|||
-./frameworks/cluster/nodes/worker.bro
|
||||
-./frameworks/cluster/setup-connections.bro
|
||||
-./frameworks/intel/cluster.bro
|
||||
-./frameworks/metrics/cluster.bro
|
||||
-./frameworks/notice/cluster.bro
|
||||
-./frameworks/sumstats/cluster.bro
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
#separator \x09
|
||||
#set_separator ,
|
||||
#empty_field (empty)
|
||||
#unset_field -
|
||||
#path metrics
|
||||
#open 2012-07-20-01-50-41
|
||||
#fields ts metric_id filter_name index.host index.str index.network value
|
||||
#types time enum string addr string subnet count
|
||||
1342749041.601712 TEST_METRIC foo-bar 6.5.4.3 - - 4
|
||||
1342749041.601712 TEST_METRIC foo-bar 7.2.1.5 - - 2
|
||||
1342749041.601712 TEST_METRIC foo-bar 1.2.3.4 - - 6
|
||||
#close 2012-07-20-01-50-49
|
|
@ -1,12 +0,0 @@
|
|||
#separator \x09
|
||||
#set_separator ,
|
||||
#empty_field (empty)
|
||||
#unset_field -
|
||||
#path metrics
|
||||
#open 2012-07-20-01-49-22
|
||||
#fields ts metric_id filter_name index.host index.str index.network value
|
||||
#types time enum string addr string subnet count
|
||||
1342748962.841548 TEST_METRIC foo-bar 6.5.4.3 - - 2
|
||||
1342748962.841548 TEST_METRIC foo-bar 7.2.1.5 - - 1
|
||||
1342748962.841548 TEST_METRIC foo-bar 1.2.3.4 - - 3
|
||||
#close 2012-07-20-01-49-22
|
|
@ -1,10 +0,0 @@
|
|||
#separator \x09
|
||||
#set_separator ,
|
||||
#empty_field (empty)
|
||||
#unset_field -
|
||||
#path notice
|
||||
#open 2013-02-11-18-41-03
|
||||
#fields ts uid id.orig_h id.orig_p id.resp_h id.resp_p proto note msg sub src dst p n peer_descr actions suppress_for dropped remote_location.country_code remote_location.region remote_location.city remote_location.latitude remote_location.longitude metric_index.host metric_index.str metric_index.network
|
||||
#types time string addr port addr port enum enum string string addr addr port count string table[enum] interval bool string string string double double addr string subnet
|
||||
1360608063.517719 - - - - - - Test_Notice Threshold crossed by metric_index(host=1.2.3.4) 100/100 - 1.2.3.4 - - 100 manager-1 Notice::ACTION_LOG 3600.000000 F - - - - - 1.2.3.4 - -
|
||||
#close 2013-02-11-18-41-03
|
|
@ -1,11 +0,0 @@
|
|||
#separator \x09
|
||||
#set_separator ,
|
||||
#empty_field (empty)
|
||||
#unset_field -
|
||||
#path notice
|
||||
#open 2012-07-20-01-49-23
|
||||
#fields ts uid id.orig_h id.orig_p id.resp_h id.resp_p proto note msg sub src dst p n peer_descr actions policy_items suppress_for dropped remote_location.country_code remote_location.region remote_location.city remote_location.latitude remote_location.longitude metric_index.host metric_index.str metric_index.network
|
||||
#types time string addr port addr port enum enum string string addr addr port count string table[enum] table[count] interval bool string string string double double addr string subnet
|
||||
1342748963.085888 - - - - - - Test_Notice Threshold crossed by metric_index(host=1.2.3.4) 3/2 - 1.2.3.4 - - 3 bro Notice::ACTION_LOG 6 3600.000000 F - - - - - 1.2.3.4 - -
|
||||
1342748963.085888 - - - - - - Test_Notice Threshold crossed by metric_index(host=6.5.4.3) 2/2 - 6.5.4.3 - - 2 bro Notice::ACTION_LOG 6 3600.000000 F - - - - - 6.5.4.3 - -
|
||||
#close 2012-07-20-01-49-23
|
|
@ -3,8 +3,8 @@
|
|||
#empty_field (empty)
|
||||
#unset_field -
|
||||
#path notice
|
||||
#open 2013-02-11-18-45-43
|
||||
#fields ts uid id.orig_h id.orig_p id.resp_h id.resp_p proto note msg sub src dst p n peer_descr actions suppress_for dropped remote_location.country_code remote_location.region remote_location.city remote_location.latitude remote_location.longitude metric_index.host metric_index.str metric_index.network
|
||||
#types time string addr port addr port enum enum string string addr addr port count string table[enum] interval bool string string string double double addr string subnet
|
||||
1360608343.088948 - - - - - - Test_Notice test notice! - - - - - worker-1 Notice::ACTION_LOG 3600.000000 F - - - - - - - -
|
||||
#close 2013-02-11-18-45-43
|
||||
#open 2013-04-02-02-21-00
|
||||
#fields ts uid id.orig_h id.orig_p id.resp_h id.resp_p proto note msg sub src dst p n peer_descr actions suppress_for dropped remote_location.country_code remote_location.region remote_location.city remote_location.latitude remote_location.longitude
|
||||
#types time string addr port addr port enum enum string string addr addr port count string table[enum] interval bool string string string double double
|
||||
1364869260.950557 - - - - - - Test_Notice test notice! - - - - - worker-1 Notice::ACTION_LOG 3600.000000 F - - - - -
|
||||
#close 2013-04-02-02-21-00
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
#empty_field (empty)
|
||||
#unset_field -
|
||||
#path notice
|
||||
#open 2013-02-11-18-45-14
|
||||
#fields ts uid id.orig_h id.orig_p id.resp_h id.resp_p proto note msg sub src dst p n peer_descr actions suppress_for dropped remote_location.country_code remote_location.region remote_location.city remote_location.latitude remote_location.longitude metric_index.host metric_index.str metric_index.network
|
||||
#types time string addr port addr port enum enum string string addr addr port count string table[enum] interval bool string string string double double addr string subnet
|
||||
1360608314.794257 - - - - - - Test_Notice test notice! - - - - - worker-2 Notice::ACTION_LOG 3600.000000 F - - - - - - - -
|
||||
#close 2013-02-11-18-45-17
|
||||
#open 2013-04-02-02-21-29
|
||||
#fields ts uid id.orig_h id.orig_p id.resp_h id.resp_p proto note msg sub src dst p n peer_descr actions suppress_for dropped remote_location.country_code remote_location.region remote_location.city remote_location.latitude remote_location.longitude
|
||||
#types time string addr port addr port enum enum string string addr addr port count string table[enum] interval bool string string string double double
|
||||
1364869289.545369 - - - - - - Test_Notice test notice! - - - - - worker-2 Notice::ACTION_LOG 3600.000000 F - - - - -
|
||||
#close 2013-04-02-02-21-32
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Host: 6.5.4.3 - num:2 - sum:6.0 - avg:3.0 - max:5.0 - min:1.0 - var:8.0 - std_dev:2.8 - unique:2
|
||||
Host: 10.10.10.10 - num:1 - sum:5.0 - avg:5.0 - max:5.0 - min:5.0 - var:0.0 - std_dev:0.0 - unique:1
|
||||
Host: 1.2.3.4 - num:9 - sum:437.0 - avg:48.6 - max:95.0 - min:3.0 - var:758.8 - std_dev:27.5 - unique:8
|
||||
Host: 7.2.1.5 - num:2 - sum:145.0 - avg:72.5 - max:91.0 - min:54.0 - var:684.5 - std_dev:26.2 - unique:2
|
|
@ -0,0 +1,3 @@
|
|||
Host: 6.5.4.3 - num:1 - sum:2.0 - var:0.0 - avg:2.0 - max:2.0 - min:2.0 - std_dev:0.0 - unique:1
|
||||
Host: 1.2.3.4 - num:5 - sum:221.0 - var:1144.2 - avg:44.2 - max:94.0 - min:5.0 - std_dev:33.8 - unique:4
|
||||
Host: 7.2.1.5 - num:1 - sum:1.0 - var:0.0 - avg:1.0 - max:1.0 - min:1.0 - std_dev:0.0 - unique:1
|
|
@ -0,0 +1 @@
|
|||
A test metric threshold was crossed with a value of: 100.0
|
|
@ -0,0 +1,6 @@
|
|||
THRESHOLD_SERIES: hit a threshold series value at 3 for sumstats_key(host=1.2.3.4)
|
||||
THRESHOLD_SERIES: hit a threshold series value at 6 for sumstats_key(host=1.2.3.4)
|
||||
THRESHOLD: hit a threshold value at 6 for sumstats_key(host=1.2.3.4)
|
||||
THRESHOLD_SERIES: hit a threshold series value at 1001 for sumstats_key(host=7.2.1.5)
|
||||
THRESHOLD: hit a threshold value at 1001 for sumstats_key(host=7.2.1.5)
|
||||
THRESHOLD WITH RATIO BETWEEN REDUCERS: hit a threshold value at 55x for sumstats_key(host=7.2.1.5)
|
|
@ -3,8 +3,8 @@
|
|||
#empty_field (empty)
|
||||
#unset_field -
|
||||
#path notice
|
||||
#open 2013-02-11-18-33-41
|
||||
#fields ts uid id.orig_h id.orig_p id.resp_h id.resp_p proto note msg sub src dst p n peer_descr actions suppress_for dropped remote_location.country_code remote_location.region remote_location.city remote_location.latitude remote_location.longitude metric_index.host metric_index.str metric_index.network
|
||||
#types time string addr port addr port enum enum string string addr addr port count string table[enum] interval bool string string string double double addr string subnet
|
||||
1348168976.558309 arKYeMETxOg 192.168.57.103 35391 192.168.57.101 55968 tcp GridFTP::Data_Channel GridFTP data channel over threshold 2 bytes - 192.168.57.103 192.168.57.101 55968 - bro Notice::ACTION_LOG 3600.000000 F - - - - - - - -
|
||||
#close 2013-02-11-18-33-41
|
||||
#open 2013-04-02-02-19-21
|
||||
#fields ts uid id.orig_h id.orig_p id.resp_h id.resp_p proto note msg sub src dst p n peer_descr actions suppress_for dropped remote_location.country_code remote_location.region remote_location.city remote_location.latitude remote_location.longitude
|
||||
#types time string addr port addr port enum enum string string addr addr port count string table[enum] interval bool string string string double double
|
||||
1348168976.558309 arKYeMETxOg 192.168.57.103 35391 192.168.57.101 55968 tcp GridFTP::Data_Channel GridFTP data channel over threshold 2 bytes - 192.168.57.103 192.168.57.101 55968 - bro Notice::ACTION_LOG 3600.000000 F - - - - -
|
||||
#close 2013-04-02-02-19-21
|
||||
|
|
9
testing/btest/Baseline/scripts.base.utils.queue/output
Normal file
9
testing/btest/Baseline/scripts.base.utils.queue/output
Normal file
|
@ -0,0 +1,9 @@
|
|||
This is a get_vector test: 3
|
||||
This is a get_vector test: 4
|
||||
Testing get: 3
|
||||
Length after get: 1
|
||||
Size of q2: 4
|
||||
String queue value: test 1
|
||||
String queue value: test 2
|
||||
String queue value: test 2
|
||||
String queue value: test 1
|
|
@ -1,78 +0,0 @@
|
|||
# @TEST-SERIALIZE: comm
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run manager-1 BROPATH=$BROPATH:.. CLUSTER_NODE=manager-1 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-run proxy-1 BROPATH=$BROPATH:.. CLUSTER_NODE=proxy-1 bro %INPUT
|
||||
# @TEST-EXEC: sleep 1
|
||||
# @TEST-EXEC: btest-bg-run worker-1 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-1 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-run worker-2 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-2 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait 30
|
||||
# @TEST-EXEC: btest-diff manager-1/metrics.log
|
||||
|
||||
@TEST-START-FILE cluster-layout.bro
|
||||
redef Cluster::nodes = {
|
||||
["manager-1"] = [$node_type=Cluster::MANAGER, $ip=127.0.0.1, $p=37757/tcp, $workers=set("worker-1", "worker-2")],
|
||||
["proxy-1"] = [$node_type=Cluster::PROXY, $ip=127.0.0.1, $p=37758/tcp, $manager="manager-1", $workers=set("worker-1", "worker-2")],
|
||||
["worker-1"] = [$node_type=Cluster::WORKER, $ip=127.0.0.1, $p=37760/tcp, $manager="manager-1", $proxy="proxy-1", $interface="eth0"],
|
||||
["worker-2"] = [$node_type=Cluster::WORKER, $ip=127.0.0.1, $p=37761/tcp, $manager="manager-1", $proxy="proxy-1", $interface="eth1"],
|
||||
};
|
||||
@TEST-END-FILE
|
||||
|
||||
redef Log::default_rotation_interval = 0secs;
|
||||
|
||||
redef enum Metrics::ID += {
|
||||
TEST_METRIC,
|
||||
};
|
||||
|
||||
event bro_init() &priority=5
|
||||
{
|
||||
Metrics::add_filter(TEST_METRIC,
|
||||
[$name="foo-bar",
|
||||
$break_interval=3secs]);
|
||||
}
|
||||
|
||||
event remote_connection_closed(p: event_peer)
|
||||
{
|
||||
terminate();
|
||||
}
|
||||
|
||||
global ready_for_data: event();
|
||||
|
||||
redef Cluster::manager2worker_events += /ready_for_data/;
|
||||
|
||||
@if ( Cluster::local_node_type() == Cluster::WORKER )
|
||||
|
||||
event ready_for_data()
|
||||
{
|
||||
Metrics::add_data(TEST_METRIC, [$host=1.2.3.4], 3);
|
||||
Metrics::add_data(TEST_METRIC, [$host=6.5.4.3], 2);
|
||||
Metrics::add_data(TEST_METRIC, [$host=7.2.1.5], 1);
|
||||
}
|
||||
|
||||
@endif
|
||||
|
||||
@if ( Cluster::local_node_type() == Cluster::MANAGER )
|
||||
|
||||
global n = 0;
|
||||
global peer_count = 0;
|
||||
|
||||
event Metrics::log_metrics(rec: Metrics::Info)
|
||||
{
|
||||
n = n + 1;
|
||||
if ( n == 3 )
|
||||
{
|
||||
terminate_communication();
|
||||
terminate();
|
||||
}
|
||||
}
|
||||
|
||||
event remote_connection_handshake_done(p: event_peer)
|
||||
{
|
||||
print p;
|
||||
peer_count = peer_count + 1;
|
||||
if ( peer_count == 3 )
|
||||
{
|
||||
event ready_for_data();
|
||||
}
|
||||
}
|
||||
|
||||
@endif
|
|
@ -1,16 +0,0 @@
|
|||
# @TEST-EXEC: bro %INPUT
|
||||
# @TEST-EXEC: btest-diff metrics.log
|
||||
|
||||
redef enum Metrics::ID += {
|
||||
TEST_METRIC,
|
||||
};
|
||||
|
||||
event bro_init() &priority=5
|
||||
{
|
||||
Metrics::add_filter(TEST_METRIC,
|
||||
[$name="foo-bar",
|
||||
$break_interval=3secs]);
|
||||
Metrics::add_data(TEST_METRIC, [$host=1.2.3.4], 3);
|
||||
Metrics::add_data(TEST_METRIC, [$host=6.5.4.3], 2);
|
||||
Metrics::add_data(TEST_METRIC, [$host=7.2.1.5], 1);
|
||||
}
|
|
@ -1,73 +0,0 @@
|
|||
# @TEST-SERIALIZE: comm
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run manager-1 BROPATH=$BROPATH:.. CLUSTER_NODE=manager-1 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-run proxy-1 BROPATH=$BROPATH:.. CLUSTER_NODE=proxy-1 bro %INPUT
|
||||
# @TEST-EXEC: sleep 1
|
||||
# @TEST-EXEC: btest-bg-run worker-1 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-1 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-run worker-2 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-2 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait 20
|
||||
# @TEST-EXEC: btest-diff manager-1/notice.log
|
||||
|
||||
@TEST-START-FILE cluster-layout.bro
|
||||
redef Cluster::nodes = {
|
||||
["manager-1"] = [$node_type=Cluster::MANAGER, $ip=127.0.0.1, $p=37757/tcp, $workers=set("worker-1")],
|
||||
["proxy-1"] = [$node_type=Cluster::PROXY, $ip=127.0.0.1, $p=37758/tcp, $manager="manager-1", $workers=set("worker-1")],
|
||||
["worker-1"] = [$node_type=Cluster::WORKER, $ip=127.0.0.1, $p=37760/tcp, $manager="manager-1", $proxy="proxy-1", $interface="eth0"],
|
||||
["worker-2"] = [$node_type=Cluster::WORKER, $ip=127.0.0.1, $p=37761/tcp, $manager="manager-1", $proxy="proxy-1", $interface="eth1"],
|
||||
};
|
||||
@TEST-END-FILE
|
||||
|
||||
redef Log::default_rotation_interval = 0secs;
|
||||
|
||||
redef enum Notice::Type += {
|
||||
Test_Notice,
|
||||
};
|
||||
|
||||
redef enum Metrics::ID += {
|
||||
TEST_METRIC,
|
||||
};
|
||||
|
||||
event bro_init() &priority=5
|
||||
{
|
||||
Metrics::add_filter(TEST_METRIC,
|
||||
[$name="foo-bar",
|
||||
$break_interval=1hr,
|
||||
$note=Test_Notice,
|
||||
$notice_threshold=100,
|
||||
$log=T]);
|
||||
}
|
||||
|
||||
event remote_connection_closed(p: event_peer)
|
||||
{
|
||||
terminate();
|
||||
}
|
||||
|
||||
@if ( Cluster::local_node_type() == Cluster::MANAGER )
|
||||
|
||||
event Notice::log_notice(rec: Notice::Info)
|
||||
{
|
||||
terminate_communication();
|
||||
terminate();
|
||||
}
|
||||
|
||||
@endif
|
||||
|
||||
@if ( Cluster::local_node_type() == Cluster::WORKER )
|
||||
|
||||
event do_metrics(i: count)
|
||||
{
|
||||
# Worker-1 will trigger an intermediate update and then if everything
|
||||
# works correctly, the data from worker-2 will hit the threshold and
|
||||
# should trigger the notice.
|
||||
Metrics::add_data(TEST_METRIC, [$host=1.2.3.4], i);
|
||||
}
|
||||
|
||||
event bro_init()
|
||||
{
|
||||
if ( Cluster::node == "worker-1" )
|
||||
schedule 2sec { do_metrics(99) };
|
||||
if ( Cluster::node == "worker-2" )
|
||||
event do_metrics(1);
|
||||
}
|
||||
|
||||
@endif
|
|
@ -0,0 +1,82 @@
|
|||
# @TEST-SERIALIZE: comm
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run manager-1 BROPATH=$BROPATH:.. CLUSTER_NODE=manager-1 bro %INPUT
|
||||
# @TEST-EXEC: sleep 1
|
||||
# @TEST-EXEC: btest-bg-run worker-1 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-1 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-run worker-2 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-2 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait 15
|
||||
|
||||
# @TEST-EXEC: btest-diff manager-1/.stdout
|
||||
|
||||
@TEST-START-FILE cluster-layout.bro
|
||||
redef Cluster::nodes = {
|
||||
["manager-1"] = [$node_type=Cluster::MANAGER, $ip=127.0.0.1, $p=37757/tcp, $workers=set("worker-1", "worker-2")],
|
||||
["worker-1"] = [$node_type=Cluster::WORKER, $ip=127.0.0.1, $p=37760/tcp, $manager="manager-1", $interface="eth0"],
|
||||
["worker-2"] = [$node_type=Cluster::WORKER, $ip=127.0.0.1, $p=37761/tcp, $manager="manager-1", $interface="eth1"],
|
||||
};
|
||||
@TEST-END-FILE
|
||||
|
||||
redef Log::default_rotation_interval = 0secs;
|
||||
|
||||
global n = 0;
|
||||
|
||||
event bro_init() &priority=5
|
||||
{
|
||||
local r1: SumStats::Reducer = [$stream="test", $apply=set(SumStats::SUM, SumStats::MIN, SumStats::MAX, SumStats::AVERAGE, SumStats::STD_DEV, SumStats::VARIANCE, SumStats::UNIQUE)];
|
||||
SumStats::create([$epoch=5secs,
|
||||
$reducers=set(r1),
|
||||
$epoch_finished(rt: SumStats::ResultTable) =
|
||||
{
|
||||
for ( key in rt )
|
||||
{
|
||||
local r = rt[key]["test"];
|
||||
print fmt("Host: %s - num:%d - sum:%.1f - avg:%.1f - max:%.1f - min:%.1f - var:%.1f - std_dev:%.1f - unique:%d", key$host, r$num, r$sum, r$average, r$max, r$min, r$variance, r$std_dev, r$unique);
|
||||
}
|
||||
|
||||
terminate();
|
||||
}]);
|
||||
}
|
||||
|
||||
event remote_connection_closed(p: event_peer)
|
||||
{
|
||||
terminate();
|
||||
}
|
||||
|
||||
global ready_for_data: event();
|
||||
redef Cluster::manager2worker_events += /^ready_for_data$/;
|
||||
|
||||
event ready_for_data()
|
||||
{
|
||||
if ( Cluster::node == "worker-1" )
|
||||
{
|
||||
SumStats::observe("test", [$host=1.2.3.4], [$num=34]);
|
||||
SumStats::observe("test", [$host=1.2.3.4], [$num=30]);
|
||||
SumStats::observe("test", [$host=6.5.4.3], [$num=1]);
|
||||
SumStats::observe("test", [$host=7.2.1.5], [$num=54]);
|
||||
}
|
||||
if ( Cluster::node == "worker-2" )
|
||||
{
|
||||
SumStats::observe("test", [$host=1.2.3.4], [$num=75]);
|
||||
SumStats::observe("test", [$host=1.2.3.4], [$num=30]);
|
||||
SumStats::observe("test", [$host=1.2.3.4], [$num=3]);
|
||||
SumStats::observe("test", [$host=1.2.3.4], [$num=57]);
|
||||
SumStats::observe("test", [$host=1.2.3.4], [$num=52]);
|
||||
SumStats::observe("test", [$host=1.2.3.4], [$num=61]);
|
||||
SumStats::observe("test", [$host=1.2.3.4], [$num=95]);
|
||||
SumStats::observe("test", [$host=6.5.4.3], [$num=5]);
|
||||
SumStats::observe("test", [$host=7.2.1.5], [$num=91]);
|
||||
SumStats::observe("test", [$host=10.10.10.10], [$num=5]);
|
||||
}
|
||||
}
|
||||
|
||||
@if ( Cluster::local_node_type() == Cluster::MANAGER )
|
||||
|
||||
global peer_count = 0;
|
||||
event remote_connection_handshake_done(p: event_peer) &priority=-5
|
||||
{
|
||||
++peer_count;
|
||||
if ( peer_count == 2 )
|
||||
event ready_for_data();
|
||||
}
|
||||
|
||||
@endif
|
34
testing/btest/scripts/base/frameworks/sumstats/basic.bro
Normal file
34
testing/btest/scripts/base/frameworks/sumstats/basic.bro
Normal file
|
@ -0,0 +1,34 @@
|
|||
# @TEST-EXEC: bro %INPUT
|
||||
# @TEST-EXEC: btest-diff .stdout
|
||||
|
||||
event bro_init() &priority=5
|
||||
{
|
||||
local r1: SumStats::Reducer = [$stream="test.metric",
|
||||
$apply=set(SumStats::SUM,
|
||||
SumStats::VARIANCE,
|
||||
SumStats::AVERAGE,
|
||||
SumStats::MAX,
|
||||
SumStats::MIN,
|
||||
SumStats::STD_DEV,
|
||||
SumStats::UNIQUE)];
|
||||
SumStats::create([$epoch=3secs,
|
||||
$reducers=set(r1),
|
||||
$epoch_finished(data: SumStats::ResultTable) =
|
||||
{
|
||||
for ( key in data )
|
||||
{
|
||||
local r = data[key]["test.metric"];
|
||||
print fmt("Host: %s - num:%d - sum:%.1f - var:%.1f - avg:%.1f - max:%.1f - min:%.1f - std_dev:%.1f - unique:%d", key$host, r$num, r$sum, r$variance, r$average, r$max, r$min, r$std_dev, r$unique);
|
||||
}
|
||||
}
|
||||
]);
|
||||
|
||||
SumStats::observe("test.metric", [$host=1.2.3.4], [$num=5]);
|
||||
SumStats::observe("test.metric", [$host=1.2.3.4], [$num=22]);
|
||||
SumStats::observe("test.metric", [$host=1.2.3.4], [$num=94]);
|
||||
SumStats::observe("test.metric", [$host=1.2.3.4], [$num=50]);
|
||||
SumStats::observe("test.metric", [$host=1.2.3.4], [$num=50]);
|
||||
|
||||
SumStats::observe("test.metric", [$host=6.5.4.3], [$num=2]);
|
||||
SumStats::observe("test.metric", [$host=7.2.1.5], [$num=1]);
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
# @TEST-SERIALIZE: comm
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run manager-1 BROPATH=$BROPATH:.. CLUSTER_NODE=manager-1 bro %INPUT
|
||||
# @TEST-EXEC: sleep 3
|
||||
# @TEST-EXEC: btest-bg-run worker-1 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-1 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-run worker-2 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-2 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait 10
|
||||
# @TEST-EXEC: btest-diff manager-1/.stdout
|
||||
|
||||
@TEST-START-FILE cluster-layout.bro
|
||||
redef Cluster::nodes = {
|
||||
["manager-1"] = [$node_type=Cluster::MANAGER, $ip=127.0.0.1, $p=37757/tcp, $workers=set("worker-1", "worker-2")],
|
||||
["worker-1"] = [$node_type=Cluster::WORKER, $ip=127.0.0.1, $p=37760/tcp, $manager="manager-1", $interface="eth0"],
|
||||
["worker-2"] = [$node_type=Cluster::WORKER, $ip=127.0.0.1, $p=37761/tcp, $manager="manager-1", $interface="eth1"],
|
||||
};
|
||||
@TEST-END-FILE
|
||||
|
||||
redef Log::default_rotation_interval = 0secs;
|
||||
|
||||
event bro_init() &priority=5
|
||||
{
|
||||
local r1: SumStats::Reducer = [$stream="test.metric", $apply=set(SumStats::SUM)];
|
||||
SumStats::create([$epoch=1hr,
|
||||
$reducers=set(r1),
|
||||
$threshold_val(key: SumStats::Key, result: SumStats::Result) =
|
||||
{
|
||||
return double_to_count(result["test.metric"]$sum);
|
||||
},
|
||||
$threshold=100,
|
||||
$threshold_crossed(key: SumStats::Key, result: SumStats::Result) =
|
||||
{
|
||||
print fmt("A test metric threshold was crossed with a value of: %.1f", result["test.metric"]$sum);
|
||||
terminate();
|
||||
}]);
|
||||
}
|
||||
|
||||
event remote_connection_closed(p: event_peer)
|
||||
{
|
||||
terminate();
|
||||
}
|
||||
|
||||
event do_stats(i: count)
|
||||
{
|
||||
# Worker-1 will trigger an intermediate update and then if everything
|
||||
# works correctly, the data from worker-2 will hit the threshold and
|
||||
# should trigger the notice.
|
||||
SumStats::observe("test.metric", [$host=1.2.3.4], [$num=i]);
|
||||
}
|
||||
|
||||
event remote_connection_handshake_done(p: event_peer)
|
||||
{
|
||||
if ( p$descr == "manager-1" )
|
||||
{
|
||||
if ( Cluster::node == "worker-1" )
|
||||
schedule 0.1sec { do_stats(1) };
|
||||
if ( Cluster::node == "worker-2" )
|
||||
schedule 0.5sec { do_stats(99) };
|
||||
}
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
# @TEST-EXEC: bro %INPUT
|
||||
# @TEST-EXEC: btest-diff .stdout
|
||||
|
||||
redef enum Notice::Type += {
|
||||
Test_Notice,
|
||||
};
|
||||
|
||||
event bro_init() &priority=5
|
||||
{
|
||||
local r1: SumStats::Reducer = [$stream="test.metric", $apply=set(SumStats::SUM)];
|
||||
SumStats::create([$epoch=3secs,
|
||||
$reducers=set(r1),
|
||||
#$threshold_val = SumStats::sum_threshold("test.metric"),
|
||||
$threshold_val(key: SumStats::Key, result: SumStats::Result) =
|
||||
{
|
||||
return double_to_count(result["test.metric"]$sum);
|
||||
},
|
||||
$threshold=5,
|
||||
$threshold_crossed(key: SumStats::Key, result: SumStats::Result) =
|
||||
{
|
||||
local r = result["test.metric"];
|
||||
print fmt("THRESHOLD: hit a threshold value at %.0f for %s", r$sum, SumStats::key2str(key));
|
||||
}
|
||||
]);
|
||||
|
||||
local r2: SumStats::Reducer = [$stream="test.metric", $apply=set(SumStats::SUM)];
|
||||
SumStats::create([$epoch=3secs,
|
||||
$reducers=set(r2),
|
||||
#$threshold_val = SumStats::sum_threshold("test.metric"),
|
||||
$threshold_val(key: SumStats::Key, result: SumStats::Result) =
|
||||
{
|
||||
return double_to_count(result["test.metric"]$sum);
|
||||
},
|
||||
$threshold_series=vector(3,6,800),
|
||||
$threshold_crossed(key: SumStats::Key, result: SumStats::Result) =
|
||||
{
|
||||
local r = result["test.metric"];
|
||||
print fmt("THRESHOLD_SERIES: hit a threshold series value at %.0f for %s", r$sum, SumStats::key2str(key));
|
||||
}
|
||||
]);
|
||||
|
||||
local r3: SumStats::Reducer = [$stream="test.metric", $apply=set(SumStats::SUM)];
|
||||
local r4: SumStats::Reducer = [$stream="test.metric2", $apply=set(SumStats::SUM)];
|
||||
SumStats::create([$epoch=3secs,
|
||||
$reducers=set(r3, r4),
|
||||
$threshold_val(key: SumStats::Key, result: SumStats::Result) =
|
||||
{
|
||||
# Calculate a ratio between sums of two reducers.
|
||||
if ( "test.metric2" in result && "test.metric" in result &&
|
||||
result["test.metric"]$sum > 0 )
|
||||
return double_to_count(result["test.metric2"]$sum / result["test.metric"]$sum);
|
||||
else
|
||||
return 0;
|
||||
},
|
||||
# Looking for metric2 sum to be 5 times the sum of metric
|
||||
$threshold=5,
|
||||
$threshold_crossed(key: SumStats::Key, result: SumStats::Result) =
|
||||
{
|
||||
local thold = result["test.metric2"]$sum / result["test.metric"]$sum;
|
||||
print fmt("THRESHOLD WITH RATIO BETWEEN REDUCERS: hit a threshold value at %.0fx for %s", thold, SumStats::key2str(key));
|
||||
}
|
||||
]);
|
||||
|
||||
SumStats::observe("test.metric", [$host=1.2.3.4], [$num=3]);
|
||||
SumStats::observe("test.metric", [$host=6.5.4.3], [$num=2]);
|
||||
SumStats::observe("test.metric", [$host=7.2.1.5], [$num=1]);
|
||||
SumStats::observe("test.metric", [$host=1.2.3.4], [$num=3]);
|
||||
SumStats::observe("test.metric", [$host=7.2.1.5], [$num=1000]);
|
||||
SumStats::observe("test.metric2", [$host=7.2.1.5], [$num=10]);
|
||||
SumStats::observe("test.metric2", [$host=7.2.1.5], [$num=1000]);
|
||||
SumStats::observe("test.metric2", [$host=7.2.1.5], [$num=54321]);
|
||||
|
||||
}
|
33
testing/btest/scripts/base/utils/queue.test
Normal file
33
testing/btest/scripts/base/utils/queue.test
Normal file
|
@ -0,0 +1,33 @@
|
|||
# @TEST-EXEC: bro -b %INPUT > output
|
||||
# @TEST-EXEC: btest-diff output
|
||||
|
||||
# This is loaded by default
|
||||
@load base/utils/queue
|
||||
|
||||
event bro_init()
|
||||
{
|
||||
local q = Queue::init([$max_len=2]);
|
||||
Queue::put(q, 1);
|
||||
Queue::put(q, 2);
|
||||
Queue::put(q, 3);
|
||||
Queue::put(q, 4);
|
||||
local test1: vector of count = vector();
|
||||
Queue::get_vector(q, test1);
|
||||
for ( i in test1 )
|
||||
print fmt("This is a get_vector test: %d", test1[i]);
|
||||
|
||||
local test_val = Queue::get(q);
|
||||
print fmt("Testing get: %s", test_val);
|
||||
print fmt("Length after get: %d", Queue::len(q));
|
||||
|
||||
local q2 = Queue::init([]);
|
||||
Queue::put(q2, "test 1");
|
||||
Queue::put(q2, "test 2");
|
||||
Queue::put(q2, "test 2");
|
||||
Queue::put(q2, "test 1");
|
||||
print fmt("Size of q2: %d", Queue::len(q2));
|
||||
local test3: vector of string = vector();
|
||||
Queue::get_vector(q2, test3);
|
||||
for ( i in test3 )
|
||||
print fmt("String queue value: %s", test3[i]);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue