output/flush: Correct EVE flushing logic#15088
Closed
Conversation
Add flushing logic driven off of the file contexts. This is a simpler solution that removes the need for logger registration changes. Overview: Use the heartbeat-driven thread to periodically flush all registered EVE contexts via a global flush list. The global flush list is a mutex-protected TAILQ of LogFileFlushEntry nodes; each node points to a LogFileCtx. Mutex = log_file_flush_mutex Periodic flushing performed by a thread according to the heartbeat.output-flush-interval [1,60]. LogFileFlushAll() is invoked to initiate flushing of registered LogFileCtx structs; each struct's fp_mutex is obtained while the flush occurs to synchronize with LogFileWrite activity. Interacts with file-rotation via the fp_mutex. Deadlock prevention: the log_file_flush_mutex must be obtained before the fp_mutex. Issue: 8286
Remove packet-based flush logic in favor of simpler solution Issue: 8286
Remove log flush functions and update registration logic as context-based flushing doesn't require it. Issue: 8286
Update output flushing description to reflect EVE based approach in documentation and config template. Issue: 8286
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #15088 +/- ##
=======================================
Coverage 82.61% 82.61%
=======================================
Files 990 990
Lines 271655 271581 -74
=======================================
- Hits 224415 224378 -37
+ Misses 47240 47203 -37
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
victorjulien
approved these changes
Mar 23, 2026
|
WARNING:
Pipeline = 30472 |
Merged
Member
|
Merged in #15091, thanks! |
5 tasks
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Continuation of #15085
Fix deficiencies in EVE-flushing logic and adopt a simpler approach that
Maintains a list of EVE file contexts
According to the configuration value
heartbeat.output-flush-interval, periodically traverse the context list and flush each.Coordinate with other usages
Add flushing logic driven by the file contexts. This is a simpler
solution that removes the need for logger registration changes.
Overview:
Use the heartbeat-driven thread to periodically flush all registered EVE
contexts via a global flush list.
The global flush list is a mutex-protected TAILQ of LogFileFlushEntry
nodes; each node points to a LogFileCtx. Mutex = log_file_flush_mutex
Periodic flushing is performed by a thread according to the
heartbeat.output-flush-interval [1,60]. LogFileFlushAll() is invoked to
initiate flushing of registered LogFileCtx structs; each struct's
fp_mutex is obtained while the flush occurs to synchronize with
LogFileWrite activity.
Interacts with file-rotation via the fp_mutex.
Deadlock prevention: the log_file_flush_mutex must be obtained before
the fp_mutex.
Note that the log_file_flush_mutex is not strictly necessary to hold during flushes; however
Link to ticket: https://redmine.openinfosecfoundation.org/issues/8286
Describe changes:
Updates:
Performance Summary
Suricata Benchmark Analysis
Date: Fri Mar 20 02:31:46 PM EDT 2026
Binary:
./src/suricata| Config:suricata.yaml| PCAP:/home/jlucovsky/pcapTest Configuration
Summary
All 48 configurations cluster tightly between ~523–534 seconds, with two notable outliers at 32kb buffer + flush=0. The overall spread is small (~10s across "normal" configs), meaning no single parameter has a dramatic effect — but consistency (low std dev) varies considerably.
Key Findings
1. Major Outlier: threaded=false, 32kb, flush=0
This configuration is a clear anomaly:
Recommendation: Avoid 32kb+ buffer sizes with flush=0 in production.
2. Threaded=false Is Slightly Faster for Buffered I/O
For buffer sizes of 4–16kb, threaded=false configurations tend to run 2–4 seconds faster on average than their threaded=true counterparts. However, for the unset (0) buffer case, threaded=false performs worse (~530–532s vs ~527–529s).
This difference is within noise for most configs, but the pattern is consistent enough to be noteworthy.
3. 8kb Buffer Is the Sweet Spot
Across both threading modes, 8kb buffer consistently delivers the best or near-best performance with low variance:
4. Flush Interval Has Mixed Impact
Flush interval shows no consistent directional effect on mean performance, but flush=0 increases variance — especially at larger buffer sizes. Using flush=30 or flush=60 tends to stabilize results without a meaningful speed penalty.
5. Large Buffers (32kb, 64kb) Offer No Benefit
Buffers larger than 16kb do not improve performance and introduce more instability (higher std dev). The gains from buffering plateau around 8–16kb.
Full Results Table
Threaded = true
Threaded = false
Values shown as mean ± std dev in seconds. Bold = global best.⚠️ = notable outlier.
Recommendations
Optimal configuration:
threaded=false,buffer-size=8kb,output-flush-interval=30Safe conservative choice:
threaded=true,buffer-size=8kb,output-flush-interval=30Avoid:
buffer-size=32kbwithoutput-flush-interval=0in either threading mode — high variance, worst-case runtimes of 545–592sbuffer-size=0withthreaded=false— consistently slower than buffered equivalents (~530–533s range)Provide values to any of the below to override the defaults.
link to the pull request in the respective
_BRANCHvariable.SV_REPO=
SV_BRANCH=
SU_REPO=
SU_BRANCH=