# Possible bug in Stats framework?

**URL:** <https://community.zeek.org/t/possible-bug-in-stats-framework/5907>\
**Category:** Zeek\
**Created:** [November 19, 2019, 2:26pm UTC](https://community.zeek.org/t/possible-bug-in-stats-framework/5907 "2019-11-19T14:26:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brittany\_Donowho](https://avatars.discourse-cdn.com/v4/letter/b/ee59a6/32.png) [@Brittany\_Donowho](https://community.zeek.org/u/Brittany_Donowho)\
**Post date:** [November 19, 2019, 2:26pm UTC](https://community.zeek.org/t/possible-bug-in-stats-framework/5907/1 "2019-11-19T14:26:52Z")

</div>

Hi,

I’ve been trying to use the stats framework on PCAP but the logs were always off by several packets (depending on the size of the trace). The numbers match up when I moved the code

if (zeek\_is\_terminating() )  
return;

To the end of stats.zeek as follows:

Log::write(Stats::LOG, info);

if ( zeek\_is\_terminating() )  
return;

schedule report\_interval { check\_stats(nettime, ns, cs, ps, es, rs, ts, fs, ds) };

Can someone verify that this is correct? I’m wondering if this edit will mess with live traffic stats.

Thanks!

Brittany Donowho

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/zeek/original/1X/f09d732bc2cc7c7cc7e35db67cf4e1d5233ce7a7.png) [@system](https://community.zeek.org/u/system)\
**Post date:** [May 6, 2022, 3:46pm UTC](https://community.zeek.org/t/possible-bug-in-stats-framework/5907/2 "2022-05-06T15:46:53Z")

</div>


