Repository navigation
Replies: 1 comment
Currently there is no simple way to do that as there isn't a built-in SimpleDateFormat pattern string. Quarkus, but not Keycloak, does support custom log formatters. If that seems viable for you, then request support for custom log formatters in Keycloak.
See #41352 |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Description
Hello,
i have a problem regarding custom logs in Keycloak. I'm using the 22.0.3 version.
On my GKE cluster is installed an Agent that detect some json logs that must be sent to Logstash (detecting a custom field that Is declared and logged correctly).
Now I have this custom log defined via the KC_LOG_CONSOLE_FORMAT : ENV KC_LOG_CONSOLE_FORMAT='{"timestamp":"%d{yyyy-MM-dd HH:mm:ss,SSS}","level":"%-5p","logger":"%c","thread":"%t","requestId":"%X{requestId}","event":"%s","stackTrace": "%s%E", "SEND_LOG": "GA"}%n' and it is working correctly, log is sent successfully.
Howewer, the monitoring group asked me if it is possible to convert the timestamp in UNIX timestamp.
For example, I want this:
{"timestamp":"1727791362","level":"WARN ","logger":"org.keycloak.quarkus.runtime.KeycloakMain","thread":"main","requestId":"","event":"Running the server in development mode. DO NOT use this configuration in production.","stackTrace": "Running the server in development mode. DO NOT use this configuration in production.", "SEND_LOG": "GA"}
Also, if it is possible to log eventually the request body, or the request headers.
Is possible to do this?
Discussion
No response
Motivation
No response
Details
No response
All reactions