Skip to content
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

Merged
merged 2 commits into from
Oct 23, 2017
Merged

Conversation

zwass
Copy link
Contributor

@zwass zwass commented Oct 20, 2017

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.

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.
Copy link
Contributor

@groob groob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good

// 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
Copy link
Contributor

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.

// Discard logs that are too big
level.Info(e.Opts.Logger).Log(
"msg",
fmt.Sprintf(
Copy link
Contributor

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

@zwass
Copy link
Contributor Author

zwass commented Oct 23, 2017

I'm going to merge this if there are no objections.

@groob
Copy link
Contributor

groob commented Oct 23, 2017

🚢

@zwass zwass merged commit 8746db2 into kolide:master Oct 23, 2017
@zwass zwass deleted the log_bytes_limit branch October 23, 2017 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants