mirror of
https://github.com/zeek/zeek.git
synced 2025-10-05 08:08:19 +00:00

- Scripts now use the full path for @load to remove the subpaths from the shipped BROPATH. - Some script sets have been reorganized to make optional loads more obvious.
21 lines
No EOL
591 B
Text
21 lines
No EOL
591 B
Text
@load frameworks/metrics
|
|
@load protocols/http
|
|
|
|
redef enum Metrics::ID += {
|
|
HTTP_REQUESTS_BY_STATUS_CODE,
|
|
HTTP_REQUESTS_BY_HOST,
|
|
};
|
|
|
|
event bro_init()
|
|
{
|
|
Metrics::configure(HTTP_REQUESTS_BY_STATUS_CODE, [$aggregation_mask=24, $break_interval=10secs]);
|
|
Metrics::configure(HTTP_REQUESTS_BY_HOST, [$break_interval=10secs]);
|
|
}
|
|
|
|
event HTTP::log_http(rec: HTTP::Info)
|
|
{
|
|
if ( rec?$host )
|
|
Metrics::add_data(HTTP_REQUESTS_BY_HOST, [$index=rec$host], 1);
|
|
if ( rec?$status_code )
|
|
Metrics::add_data(HTTP_REQUESTS_BY_STATUS_CODE, [$host=rec$id$orig_h, $index=fmt("%d", rec$status_code)], 1);
|
|
} |