Search code examples
databaseeventskeycloaksyslogkeycloak-services

Automatically transfer logs from keycloak database to syslog


I know that Keycloak saves all its "login events" on the server in the "Events" tab, but also in the database (I came across lines referring to KeycloakDS and Keycloak Database in standalone.xml). Hence my question - since login events are saved in the database, is there any way to automatically save them directly to Syslog? Is there any automaton which copies data from the database and saves it in Syslog? I've heard about various extensions for Keycloak (MQTT, RabbitMQ, or various event-listeners), but I don't know if they can be used for direct automatic copying of data from the Keycloak database to Syslog. Does anyone perhaps have any ideas/suggestions?


Solution

  • You can implement custom EventListener that will transfer all events to Syslog.

    https://www.keycloak.org/docs/latest/server_development/index.html#_events

    In your implementation you could use syslog appender (You can configute it at JBoss/wildfly level, see logging coniguration in standalone.xml).