-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Introduce rotate_compress
option for log and errors directives in Caddyfile
#1731
Introduce rotate_compress
option for log and errors directives in Caddyfile
#1731
Conversation
rotate_compress
directive in Caddyfilerotate_compress
option for log and errors directives in Caddyfile
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.
Thanks for your contribution! This is looking pretty good, but I think we can improve the Caddyfile syntax a little.
Also, this change shouldn't introduce any new dependencies, and the CI tests were passing -- I haven't seen any failures in my inbox. We don't need dependencies for the test files to be vendored. What command did you run that failed?
caddyhttp/errors/setup_test.go
Outdated
@@ -85,13 +85,14 @@ func TestErrorsParse(t *testing.T) { | |||
Roller: httpserver.DefaultLogRoller(), | |||
}, | |||
}}, | |||
{`errors errors.txt { rotate_size 2 rotate_age 10 rotate_keep 3 }`, false, ErrorHandler{ | |||
{`errors errors.txt { rotate_size 2 rotate_age 10 rotate_keep 3 rotate_compress true }`, false, ErrorHandler{ |
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.
Let's get rid of "true" here, since the presence of "rotate_compress" will make that obvious. (And lack of it is obviously "false".) In other words, the line would be "rotate_compress" by itself, no arguments.
caddyhttp/httpserver/roller.go
Outdated
directiveRotateAge = "rotate_age" | ||
directiveRotateKeep = "rotate_keep" | ||
defaultRotateKeep = 10 | ||
// defaultRotateCompress is false. |
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 comment isn't super helpful, it can be removed. ;)
@mholt re: broken dependency I just reverted the commit that adds the
Of course, I can |
This directive will enable gzip compression provided by [Lumberjack](natefinch/lumberjack#43). The directive `rotate_compress` can be `true` or `false`, being `false` by default.
7aeaec6
to
5a4e392
Compare
@mholt based on your comments:
I'll also update caddyserver/website#18 accordingly. |
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.
When you go get
a repository, it doesn't fetch test dependencies. If you go get
a repository to develop it, you should use go get -t
to download test dependencies too. But we do not need to vendor dependencies used solely for tests.
The changes look superb!! Thanks for your great work and thorough detailing.
1. What does this change do, exactly?
This PR addresses #1728 and provides a new
rotate_compress
option forlog
anderrors
directive to the Caddyfile, which will enable gzip compression for rotated log files.It also updates the Lumberjack package dependencies in the
vendor
directory, and adds go-syslog, which was not present invendor
and was breaking tests when this was not present.2. Please link to the relevant issues.
#1728
3. Which documentation changes (if any) need to be made because of this PR?
caddyserver/website#18
4. Checklist