Monitor Keycloak with Loki, and Grafana

In this project, we automated logging and metrics tracking of Keycloak, using Prometheus and Loki. We stored logs in S3 buckets for compliance. The solution enabled scalability and enhanced monitoring.


DATE:
Monday, December 2, 2024

TAGS:
ec2
mongodb
aws
terraform

Project Overview

  • The goal of this project was to automate the metrics collection and logging of Keycloak. There was a compliance requirement to store the logs for a long time. Furthermore, the team of administrators required dashboards to have insight into how many accesses to dashboards happened during the last 24 hours and they would like to have alerts to detect anomalies.

Approach & Implementation

  • We added an open source addon to keycloak to extract metrics out of. One of the concerns was to make all the the steps automated so that we could reconfigured the code for other environment. For logging, we used Loki.

Results

  • We were able to automate the whole process of setting up a logging system using Loki and Grafana.
  • We were able to check the number of people logged in to the system.
  • We could store logs for long periods of time in S3 buckets for compliance point of view.