-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
output-json: drop eve records that are too long #12165
Conversation
In the situation where the mem buffer cannot be expanded to the requested size, drop the log message. For each JSON log context, a warning will be emitted once with a partial bit of the log record being dropped to identify what event types may be leading to large log records. This also fixes the call to MemBufferExpand which is supposed be passed the amount to expand by, not the new size required. Ticket: OISF#7300
The return value was never used.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #12165 +/- ##
==========================================
+ Coverage 49.81% 49.83% +0.02%
==========================================
Files 909 909
Lines 257904 257911 +7
==========================================
+ Hits 128467 128542 +75
+ Misses 129437 129369 -68
Flags with carried forward coverage won't be shown. Click here to find out more. |
Information: QA ran without warnings. Pipeline 23585 |
@@ -981,13 +981,23 @@ int OutputJsonBuilderBuffer( | |||
size_t jslen = jb_len(js); | |||
DEBUG_VALIDATE_BUG_ON(jb_len(js) > UINT32_MAX); | |||
if (MEMBUFFER_OFFSET(*buffer) + jslen >= MEMBUFFER_SIZE(*buffer)) { | |||
MemBufferExpand(buffer, (uint32_t)jslen); | |||
size_t expand_by = MEMBUFFER_OFFSET(*buffer) + jslen + 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
git message says "This also fixes the call to MemBufferExpand which is supposed be
passed the amount to expand by, not the new size required." , however it seems the opposite happens here: total is passed.
Wonder if we should just grow to a next multiple of 4k (or PAGESIZE) that fits
output-json: drop eve records that are too long
In the situation where the mem buffer cannot be expanded to the
requested size, drop the log message.
For each JSON log context, a warning will be emitted once with a partial
bit of the log record being dropped to identify what event types may be
leading to large log records.
This also fixes the call to MemBufferExpand which is supposed be
passed the amount to expand by, not the new size required.
Ticket: https://redmine.openinfosecfoundation.org/issues/7300
output-json: cleanup, have OutputJsonBuilderBuffer return void
The return value was never used.