-
-
Notifications
You must be signed in to change notification settings - Fork 436
feat: writing logs to the filesystem with rotation support #1299
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
Merged
Conversation
This file contains hidden or 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
Signed-off-by: Xe Iaso <[email protected]>
Ref #864 You were right @kotx, it is a bad idea to set the global logger instance. Signed-off-by: Xe Iaso <[email protected]>
Signed-off-by: Xe Iaso <[email protected]>
Signed-off-by: Xe Iaso <[email protected]>
Signed-off-by: Xe Iaso <[email protected]>
Signed-off-by: Xe Iaso <[email protected]>
Signed-off-by: Xe Iaso <[email protected]>
Signed-off-by: Xe Iaso <[email protected]>
Signed-off-by: Xe Iaso <[email protected]>
Signed-off-by: Xe Iaso <[email protected]>
Assisted-by: GLM 4.6 via Claude Code Signed-off-by: Xe Iaso <[email protected]>
Signed-off-by: Xe Iaso <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #1125
When I designed Anubis' logging subsystem details, I did it with the experience of a recovering former SRE under the axiom of "you pay for log storage (cheap) or you pay for extended outages (expensive)". Most of the environments I run Anubis in have a rotating 10 megabyte log window with minimal retention.
Apparently this causes issues when used in normal distributions with normal distribution packaging. journald has issues handling Anubis' fairly moderate amount of logging and there's been numerous comments about this.
I concede that maybe an alternate approach is required here. The horrible part is that changing the default logging level isn't really an option because that would break automation.
This PR adds the ability to write logs to the filesystem instead of standard error. In order to configure this, add a
loggingblock to your policy file like this:This makes Anubis log everything to
./var/anubis.loguntil the log file is either 7 days old or 64Mi big. When a file gets too big, it gets compressed with gzip and renamed to the date it was rotated out.Additionally, you can also set the log level in the policy file:
The format of
levelis what is allowed byslog.Levelin the Go standard library. Typical values include:debuginfowarninfolevel need to be moved up to thewarnlevel in future patches.errorThese are also the same levels accepted by
--slog-levelandSLOG_LEVEL.Once this is merged, #991 needs to be fixed up and amended.
Checklist:
[Unreleased]section of docs/docs/CHANGELOG.mdnpm run test:integration(unsupported on Windows, please use WSL)