-
Notifications
You must be signed in to change notification settings - Fork 5k
fix truncated event log message #41327
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
Conversation
|
Pinging @elastic/sec-windows-platform (Team:Security-Windows Platform) |
|
|
I'm not sure how can I do it on Windows, it seems to be Linux hint? |
matthewscherer
left a comment
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.
Did you add any tests for this case as well?
|
|
||
| var bufferPtr *byte | ||
| if renderBuf != nil { | ||
| if len(renderBuf) > 0 { |
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.
👍
| // this behavior is bad for EvtFormatMessageKeyword as then the API returns a list of null terminated | ||
| // strings in the buffer (it's fine for now as we don't use this parameter value). | ||
| return common.UTF16ToUTF8Bytes(renderBuf, out) | ||
| // bufferUsed indicates the size used internally to render the message. When called with nil buffer |
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.
At some point it might be nice to profile this code and see how many time we actually see an insufficient buffer size passed to EvtFormatMessage(). I guess it's hard to know which messages our customers are using the most and which ones usually overrun this buffer.
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.
Yes, that's why I opted to increase the scratch buffer significantly to avoid double rendering. The size of the scratch buffer is still insignificant as it's only one buffer per event channel. Anyway unused memory from the buffer will just get paged out at runtime.
No I didn't add any test for the truncation as with having the fallback of allocating memory from the pool this should always succeed.
* fix truncated event log * changelog * fix warning * fix golint * playing hide an catch with CI * size in bytes * review * code review * add comment, unify code path * refactor code (cherry picked from commit 99d11eb)
* fix truncated event log * changelog * fix warning * fix golint * playing hide an catch with CI * size in bytes * review * code review * add comment, unify code path * refactor code (cherry picked from commit 99d11eb)
* fix truncated event log * changelog * fix warning * fix golint * playing hide an catch with CI * size in bytes * review * code review * add comment, unify code path * refactor code (cherry picked from commit 99d11eb)
* fix truncated event log * changelog * fix warning * fix golint * playing hide an catch with CI * size in bytes * review * code review * add comment, unify code path * refactor code (cherry picked from commit 99d11eb) Co-authored-by: Leszek Kubik <[email protected]>
* fix truncated event log * changelog * fix warning * fix golint * playing hide an catch with CI * size in bytes * review * code review * add comment, unify code path * refactor code (cherry picked from commit 99d11eb) Co-authored-by: Leszek Kubik <[email protected]>
* fix truncated event log * changelog * fix warning * fix golint * playing hide an catch with CI * size in bytes * review * code review * add comment, unify code path * refactor code (cherry picked from commit 99d11eb) Co-authored-by: Leszek Kubik <[email protected]>
Fixes
Proposed commit message
Fix windows event log ingest issues caused by event message truncation.
Checklist
CHANGELOG.next.asciidocorCHANGELOG-developer.next.asciidoc.Disruptive User Impact
Author's Checklist
How to test this PR locally
Related issues
Use cases
Screenshots
Logs