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

[Spike] Proof of concept for modular logging #4888

Draft
wants to merge 1 commit into
base: develop/6
Choose a base branch
from

Conversation

ccressent
Copy link
Contributor

@ccressent ccressent commented Oct 11, 2022

This shows a way to make logging more modular, in the spirit of #3809 and #4415.

I've included comments in the change to explain how that works and some of the issues we would need to address (e.g. the live log level changing facility with signals).

Only apid and authentication have been modified to demonstrate the approach.

This was only tested manually, playing with different --log-level apid:<level>,authentication:<level> flags and using sensuctl to log in and out and list various object types, while looking at the backend logs.

While not tested extensively, a log level with no component prefix is meant to be interpreted as the default, global log level to use for everything else that's not more finely tuned. For example, --log-level error,authentication:debug would mean that we want everything to be at log level error, with the exception of the authentication module being set to debug.

Note that we can use a very similar approach to configure different outputs for different components too. That could pave the way towards a cheap, wannabe "audit log" with a configuration like --log-output authentication:/var/log/sensu/audit.log,authorization:/var/log/sensu/audit.log, with everything else on stderr by default.

@ccressent ccressent marked this pull request as draft October 11, 2022 18:55
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.

1 participant