-
Notifications
You must be signed in to change notification settings - Fork 66
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
Set log level from a new LOG_LEVEL
env var.
#106
Merged
Merged
Conversation
This file contains 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
athamark
pushed a commit
that referenced
this pull request
Feb 8, 2023
Isolated the "github.com/siroupsen/logrus" inside the common package. All the other package import the common package. To initiate a logger we have introduced a new LoggerStardard() function, so depending on what the scope of the log message is, the caller can use either one of: * common.LoggerForRequest() * common.LoggerStandard() GitHub-PR: #106 Signed-off-by: Athanasios Markou <[email protected]>
athamark
pushed a commit
that referenced
this pull request
Feb 8, 2023
Change the log levels of certain messages to make the oidc-authservice logs less verbose. GitHub-PR: #106 Signed-off-by: Athanasios Markou <[email protected]>
athamark
pushed a commit
that referenced
this pull request
Feb 8, 2023
User will be able to configure the level of the log messages they want to receive. They can configure the new 'LOG_LEVEL' envvar to one of the following (string) values: * fatal: for fatal log messages only * error: for error and fatal log messages * warn: for warn, error, fatal log messages * info: for info, warn, error, fatal log messages * debug: for messages of all the available log levels GitHub-PR: #106 Signed-off-by: Athanasios Markou <[email protected]>
athamark
force-pushed
the
feature-athamark-set-log-level
branch
from
February 8, 2023 09:07
2e1a22b
to
977367e
Compare
athamark
pushed a commit
that referenced
this pull request
Feb 13, 2023
Isolated the "github.com/siroupsen/logrus" inside the common package. All the other package import the common package. To initiate a logger we have introduced a new LoggerStardard() function, so depending on what the scope of the log message is, the caller can use either one of: * common.LoggerForRequest() * common.LoggerStandard() GitHub-PR: #106 Signed-off-by: Athanasios Markou <[email protected]>
athamark
pushed a commit
that referenced
this pull request
Feb 13, 2023
Change the log levels of certain messages to make the oidc-authservice logs less verbose. GitHub-PR: #106 Signed-off-by: Athanasios Markou <[email protected]>
athamark
pushed a commit
that referenced
this pull request
Feb 13, 2023
User will be able to configure the level of the log messages they want to receive. They can configure the new 'LOG_LEVEL' envvar to one of the following (string) values: * fatal: for fatal log messages only * error: for error and fatal log messages * warn: for warn, error, fatal log messages * info: for info, warn, error, fatal log messages * debug: for messages of all the available log levels GitHub-PR: #106 Signed-off-by: Athanasios Markou <[email protected]>
elikatsis
pushed a commit
that referenced
this pull request
Feb 13, 2023
* Restrict the "github.com/siroupsen/logrus" import in the common package and have all other packages import common to initialize a logger * Rename the 'LoggerForRequest()' helper to 'RequestLogger()' * Introduce a new 'common.StardardLogger()' helper to initialize a StandardLogger. Depending on the scope of the log message, the caller can use either one of 'StandardLogger()' or 'RequestLogger()'. GitHub-PR: #106 Signed-off-by: Athanasios Markou <[email protected]>
elikatsis
pushed a commit
that referenced
this pull request
Feb 13, 2023
Change the log levels of certain messages to make logs less verbose. GitHub-PR: #106 Signed-off-by: Athanasios Markou <[email protected]>
elikatsis
pushed a commit
that referenced
this pull request
Feb 13, 2023
Enable to configure the level of the log messages. Expose the setting via a new 'LOG_LEVEL' envvar to one of the following (string) values: * FATAL: for fatal log messages only * ERROR: for error and fatal log messages * WARN: for warn, error, fatal log messages * INFO: for info, warn, error, fatal log messages * DEBUG: for messages of all the available log levels GitHub-PR: #106 Signed-off-by: Athanasios Markou <[email protected]>
* Restrict the "github.com/siroupsen/logrus" import in the common package and have all other packages import common to initialize a logger * Rename the 'LoggerForRequest()' helper to 'RequestLogger()' * Introduce a new 'common.StardardLogger()' helper to initialize a StandardLogger. Depending on the scope of the log message, the caller can use either one of 'StandardLogger()' or 'RequestLogger()'. GitHub-PR: #106 Signed-off-by: Athanasios Markou <[email protected]> Reviewed-by: Ilias Katsakioris <[email protected]>
Change the log levels of certain messages to make logs less verbose. GitHub-PR: #106 Signed-off-by: Athanasios Markou <[email protected]> Reviewed-by: Ilias Katsakioris <[email protected]>
Enable to configure the level of the log messages. Expose the setting via a new 'LOG_LEVEL' envvar to one of the following (string) values: * FATAL: for fatal log messages only * ERROR: for error and fatal log messages * WARN: for warn, error, fatal log messages * INFO: for info, warn, error, fatal log messages * DEBUG: for messages of all the available log levels GitHub-PR: #106 Signed-off-by: Athanasios Markou <[email protected]> Reviewed-by: Ilias Katsakioris <[email protected]>
elikatsis
force-pushed
the
feature-athamark-set-log-level
branch
from
February 13, 2023 16:11
977367e
to
58427f7
Compare
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.
During live debug sessions we realized that the AuthService logs are way too verbose and thus not helpful for debugging. Since all requests are passed through AuthService for authentication we have a chunk of logs for every one of the requests, even for requests to whitelisted URLs.
Related upstream PR
As you can see in the repo there is an upstream PR which dates back to 2019 (#3). This PR introduces a new
LOG_LEVEL
envvar that expects one of the following values:warn
info
debug
The functionality that the contributor has added seems to be in the right direction. But a lot has changed since they submitted this PR. So we had better start fresh and lay out a plan that complies with the latest
oidc-authservice
.Proposed Plan
We need to re-categorize our log messages in the available log level categories. Right now the log level which we use in
oidc-authservice
are:fatal
error
warn
info
debug
The current log messages that belong to either one of the first three log levels should remain in these log levels. The same goes for the log messages that belong to the
debug
log level.The challenge is to revise the log messages of the
info
log level which is currently way too verbose and leads to unreadable logs. The plan is to distinguish which of theinfo
log messages should belong to thedebug
log level instead. As we will expose later on, we will also transfer a few settings-relatedinfo
logs to thewarn
log level.Good to have
It would be beneficial to isolate the dependency to the
"github.com/siroupsen/logrus"
(https://github.com/sirupsen/logrus) package inside thecommon
package. For this we will need a new and simple function that sets up aStandardLogger()
:This will make our code more maintainable and also it will allow us to enforce a single log level across our code.
Regarding the order of the log levels
As exposed in the
README.md
of the"github.com/sirupsen/logrus"
library (https://github.com/sirupsen/logrus):From this I deduce that the ordering is:
panic
(we have no such log message in AuthService)fatal
error
warn
info
debug
Setting the log level to the i-th item means that all the log messages that belong to the {1, .., i} set will be logged. If a log message belongs to {i+1, ..., 6} then it will not be logged. So the bigger the configured log level is, the more verbose the logs of AuthService will be.
Let's default to
info
log level.Testing
I made a rather simple test to quantify the impact of these changes in the AuthService logs. The 5-minute experiment I did was the following:
[email protected]
(2:00)I did this for both an old and the new image. The comparison is:
Thanks for your time!