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

Keycloak-X Logging Design Document #238

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions design/keycloak.x/logging.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Keycloak X - Logging

* **Status**: Notes
* **JIRA**: TBD

## Current state

Keycloak.X leverages uses JBoss Log Manager and the JBoss Logging facade thats provided by Quarkus.

By default the log messages are unstructured text with timestamps and thread and call-site information
printed to the console or a log file. There are many ways to parse this format, which often
require an additional translation step to create a structured log message from a given log line.

## Desired state

Keycloak should provide native support for structured logging to avoid additional translation steps.
JSON is a commonly used format for structured logging and should be supported natively, and other formats like GELF or binary encodings should also be possible.

It should also be possible to add additional context information to a log message,
e.g. by leveraging the MDC (Mapped Diagnostic Context) support provided by JBoss-Logging.

## Additional Thoughts

- I think it makes sense to keep the log messages plain text in %dev profile.
- Should we enable JSON Logging by default in prod, or put it behind a short-flag? (`log-format=json` vs. `log-format=plain`)
- Should be already allow Quarkus JSON logging support? KEYCLOAK-17057
- How should we handle open-tracing information in logs? Already supported via MDC Logging?
- Could / Should we provide more advanced log patterns (e.g. with OpenTracing log fields)?

## Related Designs

- [Observerability](https://github.com/keycloak/keycloak-community/blob/master/design/observerability.md)

## Related Issues

- [KEYCLOAK-17057 | Add support for JSON Logging in Keycloak.X](https://issues.redhat.com/browse/KEYCLOAK-17057)