Grafana dashboard: auth activity (logins, failures, active users) #252

Open
opened 2026-03-30 16:05:59 +00:00 by forgejo_admin · 0 comments
Contributor

Type

Feature

Lineage

Standalone -- discovered during jersey ordering session 2026-03-29. Depends on Keycloak event logging ticket.

Repo

forgejo_admin/pal-e-platform

User Story

As an admin
I want a Grafana dashboard showing login activity over time, failed attempts, and active users
So that I can monitor how parents and coaches are using the platform

Context

Structured API logs already include user_id per authenticated request (basketball-api logging_config.py). Once Keycloak event logging is enabled (separate ticket), LOGIN/LOGOUT/ERROR events will flow to Loki. This ticket builds the Grafana dashboard to visualize both sources.

Existing dashboards live in terraform/dashboards/ as JSON files and are provisioned via the monitoring module.

File Targets

Files the agent should modify or create:

  • terraform/dashboards/auth-activity-dashboard.json -- new dashboard JSON with panels for login activity, failures, active users
  • terraform/modules/monitoring/main.tf -- register the new dashboard in Grafana provisioning config (follow pattern of existing dashboards)

Files the agent should NOT touch:

  • basketball-api/ -- no application code changes
  • terraform/modules/keycloak/ -- Keycloak config is a separate ticket

Acceptance Criteria

  • When I open Grafana, there is an "Auth Activity" dashboard
  • Dashboard shows logins over time (line chart, 24h/7d/30d selectable)
  • Dashboard shows failed login attempts as a separate panel
  • Dashboard shows unique active users per day
  • Dashboard shows top users by API request count (from structured logs)

Test Expectations

  • Manual test: dashboard loads in Grafana without errors
  • Manual test: panels populate with data from Loki queries
  • Run command: tofu plan -lock=false to verify provisioning changes

Constraints

  • Follow existing dashboard patterns in terraform/dashboards/
  • Loki queries for Keycloak events and API structured logs
  • Dashboard must work with Grafana version deployed on cluster

Checklist

  • PR opened
  • Tests pass
  • No unrelated changes
  • project-pal-e-platform -- platform infrastructure
  • Depends on: Keycloak event logging ticket
### Type Feature ### Lineage Standalone -- discovered during jersey ordering session 2026-03-29. Depends on Keycloak event logging ticket. ### Repo `forgejo_admin/pal-e-platform` ### User Story As an admin I want a Grafana dashboard showing login activity over time, failed attempts, and active users So that I can monitor how parents and coaches are using the platform ### Context Structured API logs already include `user_id` per authenticated request (basketball-api logging_config.py). Once Keycloak event logging is enabled (separate ticket), LOGIN/LOGOUT/ERROR events will flow to Loki. This ticket builds the Grafana dashboard to visualize both sources. Existing dashboards live in `terraform/dashboards/` as JSON files and are provisioned via the monitoring module. ### File Targets Files the agent should modify or create: - `terraform/dashboards/auth-activity-dashboard.json` -- new dashboard JSON with panels for login activity, failures, active users - `terraform/modules/monitoring/main.tf` -- register the new dashboard in Grafana provisioning config (follow pattern of existing dashboards) Files the agent should NOT touch: - `basketball-api/` -- no application code changes - `terraform/modules/keycloak/` -- Keycloak config is a separate ticket ### Acceptance Criteria - [ ] When I open Grafana, there is an "Auth Activity" dashboard - [ ] Dashboard shows logins over time (line chart, 24h/7d/30d selectable) - [ ] Dashboard shows failed login attempts as a separate panel - [ ] Dashboard shows unique active users per day - [ ] Dashboard shows top users by API request count (from structured logs) ### Test Expectations - [ ] Manual test: dashboard loads in Grafana without errors - [ ] Manual test: panels populate with data from Loki queries - Run command: `tofu plan -lock=false` to verify provisioning changes ### Constraints - Follow existing dashboard patterns in `terraform/dashboards/` - Loki queries for Keycloak events and API structured logs - Dashboard must work with Grafana version deployed on cluster ### Checklist - [ ] PR opened - [ ] Tests pass - [ ] No unrelated changes ### Related - `project-pal-e-platform` -- platform infrastructure - Depends on: Keycloak event logging ticket
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ldraney/pal-e-platform#252
No description provided.