mirror of
https://github.com/zeek/zeek.git
synced 2025-10-14 12:38:20 +00:00
Merge remote-tracking branch 'origin/topic/awelzel/try-log-stream-metrics'
* origin/topic/awelzel/try-log-stream-metrics: Bump external test suites, filter some telemetry.log entries logging/Manager: Remove unused variable logging: Add telemetry for streams and log writers
This commit is contained in:
commit
802d24cad7
10 changed files with 135 additions and 10 deletions
36
testing/btest/scripts/base/frameworks/logging/telemetry.zeek
Normal file
36
testing/btest/scripts/base/frameworks/logging/telemetry.zeek
Normal file
|
@ -0,0 +1,36 @@
|
|||
# @TEST-DOC: Check telemetry.log for log stream and log filter writes.
|
||||
# @TEST-EXEC: zeek -b -r ${TRACES}/wikipedia.trace %INPUT
|
||||
# @TEST-EXEC: btest-diff telemetry.log
|
||||
|
||||
@load base/protocols/conn
|
||||
@load base/protocols/dns
|
||||
@load base/protocols/http
|
||||
|
||||
@load policy/frameworks/telemetry/log
|
||||
|
||||
global http_logs = 0;
|
||||
hook HTTP::log_policy(rec: HTTP::Info, id: Log::ID, filter: Log::Filter)
|
||||
{
|
||||
if (++http_logs % 3 == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
global dns_logs = 0;
|
||||
global conn_logs = 0;
|
||||
hook Log::log_stream_policy(rec: any, id: Log::ID)
|
||||
{
|
||||
if (id == DNS::LOG && ++dns_logs % 3 == 0)
|
||||
break;
|
||||
|
||||
if (id == Conn::LOG && ++conn_logs % 7 == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
hook Telemetry::log_policy(rec: Telemetry::Info, id: Log::ID, filter: Log::Filter)
|
||||
{
|
||||
if ( rec$prefix != "zeek" || /^log-/ !in rec$name )
|
||||
break;
|
||||
|
||||
if ( /HTTP|DNS|Conn/ !in cat(rec$label_values) )
|
||||
break;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue