:tocdepth: 3

policy/misc/stats.bro
=====================
.. bro:namespace:: Stats

Log memory/packet/lag statistics.  Differs from
:doc:`/scripts/policy/misc/profiling.bro` in that this
is lighter-weight (much less info, and less load to generate).

:Namespace: Stats
:Imports: :doc:`base/frameworks/notice </scripts/base/frameworks/notice/index>`
:Source File: :download:`/scripts/policy/misc/stats.bro`

Summary
~~~~~~~
Options
#######
=============================================================================== =============================
:bro:id:`Stats::stats_report_interval`: :bro:type:`interval` :bro:attr:`&redef` How often stats are reported.
=============================================================================== =============================

Types
#####
=========================================== =
:bro:type:`Stats::Info`: :bro:type:`record` 
=========================================== =

Redefinitions
#############
===================================== =
:bro:type:`Log::ID`: :bro:type:`enum` 
===================================== =

Events
######
============================================= ===============================================================
:bro:id:`Stats::log_stats`: :bro:type:`event` Event to catch stats as they are written to the logging stream.
============================================= ===============================================================


Detailed Interface
~~~~~~~~~~~~~~~~~~
Options
#######
.. bro:id:: Stats::stats_report_interval

   :Type: :bro:type:`interval`
   :Attributes: :bro:attr:`&redef`
   :Default: ``1.0 min``

   How often stats are reported.

Types
#####
.. bro:type:: Stats::Info

   :Type: :bro:type:`record`

      ts: :bro:type:`time` :bro:attr:`&log`
         Timestamp for the measurement.

      peer: :bro:type:`string` :bro:attr:`&log`
         Peer that generated this log.  Mostly for clusters.

      mem: :bro:type:`count` :bro:attr:`&log`
         Amount of memory currently in use in MB.

      pkts_proc: :bro:type:`count` :bro:attr:`&log`
         Number of packets processed since the last stats interval.

      events_proc: :bro:type:`count` :bro:attr:`&log`
         Number of events processed since the last stats interval.

      events_queued: :bro:type:`count` :bro:attr:`&log`
         Number of events that have been queued since the last stats
         interval.

      lag: :bro:type:`interval` :bro:attr:`&log` :bro:attr:`&optional`
         Lag between the wall clock and packet timestamps if reading
         live traffic.

      pkts_recv: :bro:type:`count` :bro:attr:`&log` :bro:attr:`&optional`
         Number of packets received since the last stats interval if
         reading live traffic.

      pkts_dropped: :bro:type:`count` :bro:attr:`&log` :bro:attr:`&optional`
         Number of packets dropped since the last stats interval if
         reading live traffic.

      pkts_link: :bro:type:`count` :bro:attr:`&log` :bro:attr:`&optional`
         Number of packets seen on the link since the last stats
         interval if reading live traffic.


Events
######
.. bro:id:: Stats::log_stats

   :Type: :bro:type:`event` (rec: :bro:type:`Stats::Info`)

   Event to catch stats as they are written to the logging stream.


