-
Notifications
You must be signed in to change notification settings - Fork 103
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
Limit log writes by number of bytes #191
Conversation
Previously, buffered log writes were limited by the total number of logs. Now they are limited by total number of bytes, and logs that are over the max size limit are dropped.
4de0f52
to
e60c50f
Compare
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 looks good
osquery/extension.go
Outdated
// Default maximum number of bytes per batch (used if not specified in | ||
// options). This 4MB limit is chosen based on the default grpc-go | ||
// limit specified in https://github.com/grpc/grpc-go/blob/master/server.go#L51 | ||
defaultMaxBytesPerBatch = 4 * 1024 * 1024 |
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.
thoughts on using 4 << 20
here? It's a more common notation for constants.
osquery/extension.go
Outdated
// Discard logs that are too big | ||
level.Info(e.Opts.Logger).Log( | ||
"msg", | ||
fmt.Sprintf( |
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.
use key/values instead of sprintf
I'm going to merge this if there are no objections. |
🚢 |
Previously, buffered log writes were limited by the total number of logs. Now
they are limited by total number of bytes, and logs that are over the max size
limit are dropped.