Enable Keycloak event logging for login/logout/error events #251
Labels
No labels
domain:backend
domain:devops
domain:frontend
status:approved
status:in-progress
status:needs-fix
status:qa
type:bug
type:devops
type:feature
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ldraney/pal-e-platform#251
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Type
Feature
Lineage
Standalone -- discovered during jersey ordering session 2026-03-29. No parent issue.
Repo
forgejo_admin/pal-e-platformUser Story
As an admin
I want Keycloak to log login, logout, and failed login events to stdout
So that I can query auth activity in Loki/Grafana and detect issues early
Context
Keycloak has a built-in event system (LOGIN, LOGIN_ERROR, LOGOUT, REGISTER, etc.) that is currently NOT configured in the westside-basketball realm. No login events are captured anywhere. Structured API logs include user_id per request (basketball-api logging_config.py), but there's no record of the auth event itself -- when someone logs in, fails to log in, or logs out.
Keycloak supports event listeners out of the box. The
jboss-logginglistener writes events to stdout, which Loki already scrapes from all pods. Enabling this is a configuration change, not a code change.File Targets
Files the agent should modify or create:
terraform/modules/keycloak/main.tf-- Add Keycloak startup CLI commands or environment variables to enable realm event logging:eventsEnabled=true,eventsListeners=["jboss-logging"],enabledEventTypes=["LOGIN","LOGIN_ERROR","LOGOUT","REGISTER","REGISTER_ERROR"]Files the agent should NOT touch:
basketball-api/-- no application code changes neededwestside-app/-- no frontend changes neededAcceptance Criteria
Test Expectations
kubectl logson keycloak pod shows LOGIN eventtofu plan -lock=falseto verify no unintended changesConstraints
feedback_keycloak_first.md-- use Keycloak built-in featuresChecklist
Related
project-pal-e-platform-- platform infrastructure