forked from elastic/beats
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Auditbeat] Reduce system/socket logging noise (elastic#15890)
* Make ThreadEnter errors less noisy The socket dataset uses ThreadEnter(event) / ThreadLeave(event) as a single-event per-thread state tracking, useful for correlating function calls and their return values. However, in some cases functions are stacked, like sys_execve() calling itself recursively or inet6_create() calling inet_create(). This results in an existing stored event to be evicted, which is not a problem but currently is causing a warning to be printed to the logs. This patch makes two changes to this situation: - Only print warnings from the state machine when socketdetailed selector is enabled. The state machine currently only generates warnings for ThreadEnter/ThreadExit issues. - Change ThreadEnter errors to be constructed on demand by their Error() method, so that the somewhat expensive fmt.Sprintf() / event.String() is only invoked if the error is going to be printed to the log. This is a huge CPU saving in systems where this benign eviction is happening frequently. * socketdetailed selector has to be enabled explicitly This selector is extremely noisy. This change excludes it from being enabled when debug is enabled with `-d '*'` and requires it to be explicitly defined: `-d '*,socketdetailed'`. * Print template variables when socket debug is enabled It makes no sense to print guesses' progress in regular debug (socket) and the resulting template variables only when socketdetailed is set. * Fix syscall arguments usage in guesses The syscall parameter templates (`SYS_Pn`) were not valid until guess_syscall_args runs. As the variables `SYS_Pn` already existed, another guess using them could use the wrong values because the dependency mechanism only checks if the variable exists. The fix for this is to have temporary variables (`_SYS_Pn`) and have guess_syscall_args create the definitive ones. This didn't cause any bug as the only guess that used syscall args is the new guess_deref which is enabled on demand via an environment variable for diagnostic purposes.
- Loading branch information
Showing
5 changed files
with
44 additions
and
31 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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