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

Allow configuration of loggers through Caddyfile global options #4028

Merged
merged 1 commit into from
Mar 12, 2021

Conversation

kujenga
Copy link
Contributor

@kujenga kujenga commented Feb 18, 2021

This PR is a follow up on the previous attempt in #3968 but instead implemented as a global logging option.

It follows up on discussion in #3958 about adding more functionality to the Caddyfile. I also added in another commit for a small new "replace" filter aimed at the same goal as I wrote up in the original ticket, providing more tools to remove sensitive data from logs.

Closes #3958

@kujenga kujenga force-pushed the at/caddy-log-safety-global-opt branch from 7040240 to 89eec90 Compare February 18, 2021 05:05
@francislavoie francislavoie added this to the 2.x milestone Feb 18, 2021
@kujenga kujenga force-pushed the at/caddy-log-safety-global-opt branch from 89eec90 to e66bcbb Compare February 18, 2021 13:20
@kujenga kujenga force-pushed the at/caddy-log-safety-global-opt branch from e66bcbb to 5e01204 Compare February 18, 2021 20:52
@kujenga kujenga marked this pull request as ready for review February 19, 2021 03:04
@kujenga kujenga changed the title Allow global Caddyfile configuration of loggers, add new replace log filter Allow configuration of loggers through Caddyfile global options Feb 19, 2021
@kujenga kujenga force-pushed the at/caddy-log-safety-global-opt branch 2 times, most recently from c8f5a6f to db291e8 Compare March 3, 2021 00:54
@kujenga
Copy link
Contributor Author

kujenga commented Mar 8, 2021

Hi @mholt @francislavoie , just checking in, any thoughts on the simplified approach this PR now takes? Happy to make any further iterations as wanted.

Copy link
Member

@francislavoie francislavoie left a comment

Choose a reason for hiding this comment

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

Looks good to me! Thanks for the effort! 🎉

@francislavoie francislavoie modified the milestones: 2.x, v2.4.0 Mar 8, 2021
Copy link
Member

@francislavoie francislavoie left a comment

Choose a reason for hiding this comment

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

Actually, noticed a couple more things on a quick second pass, sorry 😅

caddyconfig/httpcaddyfile/builtins.go Outdated Show resolved Hide resolved
caddyconfig/httpcaddyfile/builtins.go Outdated Show resolved Hide resolved
caddyconfig/httpcaddyfile/options_test.go Show resolved Hide resolved
@kujenga kujenga force-pushed the at/caddy-log-safety-global-opt branch 3 times, most recently from ebe14d9 to 5507ec4 Compare March 9, 2021 19:14
@kujenga
Copy link
Contributor Author

kujenga commented Mar 9, 2021

Alright, this is rebased on master now as well, if there's anything else just let me know!

@kujenga kujenga force-pushed the at/caddy-log-safety-global-opt branch from 5507ec4 to 7c2f314 Compare March 10, 2021 04:36
francislavoie
francislavoie previously approved these changes Mar 11, 2021
mholt
mholt previously approved these changes Mar 11, 2021
Copy link
Member

@mholt mholt left a comment

Choose a reason for hiding this comment

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

Awesome, thanks for your reviews Francis and for the work on this, @kujenga -- LGTM, just one comment where a slight improvement could be made if I'm right. Ignore if not. :)

caddyconfig/httpcaddyfile/builtins.go Outdated Show resolved Hide resolved
This change is aimed at enhancing the logging module within the
Caddyfile directive to allow users to configure logs other than the HTTP
access log stream, which is the current capability of the Caddyfile [1].
The intent here is to leverage the same syntax as the server log
directive at a global level, so that similar customizations can be added
without needing to resort to a JSON-based configuration.

Discussion for this approach happened in the referenced issue.

Closes caddyserver#3958

[1] https://caddyserver.com/docs/caddyfile/directives/log
@kujenga kujenga dismissed stale reviews from mholt and francislavoie via d99bbd7 March 12, 2021 15:51
@kujenga kujenga force-pushed the at/caddy-log-safety-global-opt branch from 7c2f314 to d99bbd7 Compare March 12, 2021 15:51
@kujenga
Copy link
Contributor Author

kujenga commented Mar 12, 2021

Alright, this has been rebased on master and I believe the last comment is now addressed!

Copy link
Member

@mholt mholt left a comment

Choose a reason for hiding this comment

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

Excellent, thanks for the contribution @kujenga ! Please feel free to contribute again sometime. :) Especially if any issues with these changes are reported later. Thank you!

@mholt mholt merged commit 2a127ac into caddyserver:master Mar 12, 2021
@kujenga
Copy link
Contributor Author

kujenga commented Mar 12, 2021

Awesome, thank you! Feel free to ping me if anything does come up 👍

@francislavoie
Copy link
Member

francislavoie commented Mar 14, 2021

@kujenga would you like to take a shot at writing the docs for this? You can find them here https://github.com/caddyserver/website/blob/master/src/docs/markdown/caddyfile/options.md

While you're at it, you could also add docs for the new redact filter to https://github.com/caddyserver/website/blob/master/src/docs/markdown/caddyfile/directives/log.md

kujenga added a commit to kujenga/caddy-website that referenced this pull request Mar 19, 2021
kujenga added a commit to kujenga/caddy-website that referenced this pull request Mar 27, 2021
mholt pushed a commit to caddyserver/website that referenced this pull request Apr 8, 2021
* caddyfile/directives/log: add docs for new replace directive

This commit corresponds with the functionality added in this PR:
caddyserver/caddy#4029

* caddyfile: add documentation for new global log option

This corresponds with the changes in this PR:
caddyserver/caddy#4028
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Caddyfile options to configure error log output
3 participants