Introduce get_packet_lag()

This commit is contained in:
Jan Grashoefer 2024-12-09 19:19:29 +01:00
parent 6977c07a25
commit c2b17f9d30
3 changed files with 29 additions and 11 deletions

View file

@ -2,6 +2,7 @@
@load base/frameworks/notice
@load base/frameworks/telemetry
@load base/utils/time
module Stats;
@ -166,8 +167,6 @@ event zeek_init() &priority=5
Log::create_stream(Stats::LOG, [$columns=Info, $ev=log_stats, $path="stats", $policy=log_policy]);
}
const null_ts = double_to_time(0);
event check_stats(then: time, last_ns: NetStats, last_cs: ConnStats, last_ps: ProcStats, last_es: EventStats, last_rs: ReassemblerStats, last_ts: TimerStats, last_fs: FileAnalysisStats, last_ds: DNSStats)
{
local nettime = network_time();
@ -216,8 +215,7 @@ event check_stats(then: time, last_ns: NetStats, last_cs: ConnStats, last_ps: Pr
if ( reading_live_traffic() )
{
local pkt_ts = get_current_packet_ts();
info$pkt_lag = pkt_ts > null_ts ? current_time() - pkt_ts : 0 sec;
info$pkt_lag = get_packet_lag();
info$pkts_dropped = ns$pkts_dropped - last_ns$pkts_dropped;
info$pkts_link = ns$pkts_link - last_ns$pkts_link;