]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
schema: add descriptions for flow stats counters
authorJuliana Fajardini <jufajardini@oisf.net>
Fri, 8 Aug 2025 15:42:38 +0000 (12:42 -0300)
committerVictor Julien <victor@inliniac.net>
Fri, 29 Aug 2025 07:09:47 +0000 (09:09 +0200)
Task #7794

etc/schema.json
src/flow-hash.c

index 2551c97c989d35e8cee370f82caad3e659304224..7924eb41cb72cbef6707339188c35f2ad5084714 100644 (file)
                 },
                 "flow": {
                     "type": "object",
+                    "description": "Stats on flow-related diagnostics",
                     "additionalProperties": false,
                     "properties": {
                         "active": {
                                     "additionalProperties": false,
                                     "properties": {
                                         "capture_bypassed": {
-                                            "type": "integer"
+                                            "type": "integer",
+                                            "description": "Number of flows bypassed at the capture level -- counted at the time of flow end"
                                         },
                                         "closed": {
-                                            "type": "integer"
+                                            "type": "integer",
+                                            "description": "Number of flows in 'closed' state at the time of flow end"
                                         },
                                         "established": {
-                                            "type": "integer"
+                                            "type": "integer",
+                                            "description": "Number of flows in 'established' state at the time of flow end"
                                         },
                                         "local_bypassed": {
-                                            "type": "integer"
+                                            "type": "integer",
+                                            "description": "Number of flows bypassed internally -- counted at the time of flow end"
                                         },
                                         "new": {
-                                            "type": "integer"
+                                            "type": "integer",
+                                            "description": "Number of flows in 'new' state at the time of flow end"
                                         }
                                     }
                                 },
                                 "tcp_liberal": {
-                                    "type": "integer"
+                                    "type": "integer",
+                                    "description": "Number of TCP flows ended that had liberal state"
                                 },
                                 "tcp_state": {
                                     "type": "object",
                                     "additionalProperties": false,
                                     "properties": {
                                         "close_wait": {
-                                            "type": "integer"
+                                            "type": "integer",
+                                            "description": "Number of TCP sessions in CLOSE_WAIT state"
                                         },
                                         "closed": {
-                                            "type": "integer"
+                                            "type": "integer",
+                                            "description": "Number of TCP sessions in CLOSED state"
                                         },
                                         "closing": {
-                                            "type": "integer"
+                                            "type": "integer",
+                                            "description": "Number of TCP sessions in CLOSING state"
                                         },
                                         "established": {
-                                            "type": "integer"
+                                            "type": "integer",
+                                            "description": "Number of TCP sessions in ESTABLISHED state"
                                         },
                                         "fin_wait1": {
-                                            "type": "integer"
+                                            "type": "integer",
+                                            "description": "Number of TCP sessions in FIN_WAIT_1 state"
                                         },
                                         "fin_wait2": {
-                                            "type": "integer"
+                                            "type": "integer",
+                                            "description": "Number of TCP sessions in FIN_WAIT_2 state"
                                         },
                                         "last_ack": {
-                                            "type": "integer"
+                                            "type": "integer",
+                                            "description": "Number of TCP sessions in LAST_ACK state"
                                         },
                                         "none": {
-                                            "type": "integer"
+                                            "type": "integer",
+                                            "description": "Number of TCP sessions newly created"
                                         },
                                         "syn_recv": {
-                                            "type": "integer"
+                                            "type": "integer",
+                                            "description": "Number of TCP sessions in SYN_RECV state"
                                         },
                                         "syn_sent": {
-                                            "type": "integer"
+                                            "type": "integer",
+                                            "description": "Number of TCP sessions in SYN_SENT state"
                                         },
                                         "time_wait": {
-                                            "type": "integer"
+                                            "type": "integer",
+                                            "description": "Number of TCP sessions in TIME_WAIT state"
                                         }
                                     }
                                 }
                         },
                         "mgr": {
                             "type": "object",
+                            "description": "Flow manager stats counters",
                             "additionalProperties": false,
                             "properties": {
                                 "flows_checked": {
                         },
                         "wrk": {
                             "type": "object",
+                            "description": "Flow worker threads stats",
                             "additionalProperties": false,
                             "properties": {
                                 "flows_evicted": {
-                                    "type": "integer"
+                                    "type": "integer",
+                                    "description": "Number of flows that were evicted"
                                 },
                                 "flows_evicted_needs_work": {
-                                    "type": "integer"
+                                    "type": "integer",
+                                    "description": "Number of TCP flows that were returned to the workers in case reassembly, detection, logging still needs work"
                                 },
                                 "flows_evicted_pkt_inject": {
-                                    "type": "integer"
+                                    "type": "integer",
+                                    "description": "Number of pseudo packets injected into worker threads to complete flows' processing. For any flow this can be between 0-2, this is the total for all flows."
                                 },
                                 "flows_injected": {
-                                    "type": "integer"
+                                    "type": "integer",
+                                    "description": "Number of flows injected into the worker thread from another thread"
                                 },
                                 "flows_injected_max": {
-                                    "type": "integer"
+                                    "type": "integer",
+                                    "description": "Maximum number of flows injected into the worker thread from another thread"
                                 },
                                 "spare_sync": {
-                                    "type": "integer"
+                                    "type": "integer",
+                                    "description": "Number of times the engine attempted to fetch flows from the master flow pool/spare queue"
                                 },
                                 "spare_sync_avg": {
-                                    "type": "integer"
+                                    "type": "integer",
+                                    "description": "Average number of flows a thread could fetch from the master flow pool/spare queue"
                                 },
                                 "spare_sync_empty": {
-                                    "type": "integer"
+                                    "type": "integer",
+                                    "description": "Number of times the master spare pool was empty when requesting flows from it"
                                 },
                                 "spare_sync_incomplete": {
-                                    "type": "integer"
+                                    "type": "integer",
+                                    "description": "Number of times spare flow syncs were incomplete (fetched with less than 100 flows in sync)"
                                 }
                             }
                         }
index 2642dad3056966475e2453ad3ce3ea8578722630..632e5668b774e1861aa800452943c4d88525b88d 100644 (file)
@@ -641,6 +641,10 @@ static inline Flow *FlowSpareSync(ThreadVars *tv, FlowLookupStruct *fls,
             if (f != NULL) {
                 StatsAddUI64(tv, fls->dtv->counter_flow_spare_sync_avg, fls->spare_queue.len+1);
                 if (fls->spare_queue.len < 99) {
+                    /* When a new flow pool is fetched it has 100 flows in sync,
+                     * so there should be 99 left if we're in full sync.
+                     * If len is below 99, means the spare sync is incomplete */
+                    /* Track these instances */
                     StatsIncr(tv, fls->dtv->counter_flow_spare_sync_incomplete);
                 }
             } else if (fls->spare_queue.len == 0) {