On this page
Short answer
Enable the metrics-enabled and health-enabled build options, scrape /metrics and probe /health/ready on the management port (9000 by default), and alert on availability, login latency, server errors and the database check rather than on CPU alone.
Enable the metrics-enabled and health-enabled build options, scrape /metrics and probe /health/ready on the management port (9000 by default), and alert on availability, login latency, server errors and the database check rather than on CPU alone.
This guide follows Keycloak's observability and management interface documentation. If you run Keycloak for production logins and want a second set of eyes on your alerting, see our Keycloak support page.
How do you enable Keycloak metrics and health checks?
Both are build-time options that default to false. Set --metrics-enabled=true and --health-enabled=true when you build or start the server, or use the environment variables KC_METRICS_ENABLED and KC_HEALTH_ENABLED. Metrics come out in OpenMetrics text format at /metrics.
| Option | Default | What it does |
|---|---|---|
metrics-enabled | false | Exposes /metrics |
health-enabled | false | Exposes /health endpoints; also turns on async bootstrap |
http-metrics-histograms-enabled | false | Histogram with default buckets for HTTP request duration |
http-metrics-slos | none | Latency buckets in milliseconds |
cache-metrics-histograms-enabled | false | Histograms for embedded caches |
event-metrics-user-enabled | false | Per-event user metrics; needs metrics and the user-event-metrics feature |
The histogram options only work when metrics are enabled. See the Keycloak metrics configuration guide.
Which port and interface serve Keycloak metrics and health?
The management interface, on port 9000 by default. The management interface guide says it turns on when something is exposed on it, and that health checks and metrics are currently the only things it serves. Change the port with http-management-port and the path prefix with http-management-relative-path.
- If TLS is configured on the main server, the management interface uses HTTPS by default. Set
http-management-schemetohttpto force plain HTTP. http-management-health-enableddefaults to true. If you set it to false, health endpoints move back to the main ports and the health guide says to block external access to/healthat your proxy.legacy-observability-interfaceputs metrics and health on the main server. It is deprecated, and the guide does not recommend it for security reasons.
The point of the separate port is that on Kubernetes you can keep it unexposed outside the cluster. For container and probe setup, see Docker to production.
Which Keycloak health endpoint should each probe use?
Use /health/started for the startup probe, /health/live for liveness and /health/ready for readiness and load balancer checks. Each returns 200 on success and 503 on failure with a JSON body. The aggregate /health endpoint combines all checks.
| Endpoint | Use it for | Docs note |
|---|---|---|
/health/started | Startup probe | Hands over to liveness after startup |
/health/live | Restart decisions | Failure means restart the instance |
/health/ready | Traffic routing | Reports DOWN until initialization completes |
/health | Everything combined | Aggregates all checks |
The included checks are the database connection pool (needs metrics enabled), cluster status (only with the jdbc-ping or jdbc-ping-udp stacks), graceful shutdown and server initialization. The production guide notes that initialization such as database migration can take a long time, and that with health enabled the ports open early while readiness stays DOWN. The health guide also says the readiness endpoint should not decide whether a container is restarted.
What should you alert on in Keycloak?
Start with the three service level indicators in Keycloak's own SLI guide: availability, latency and errors. Then add the readiness and database checks from the health endpoints. The guide's examples are 99.9% availability, 95% of authentication requests under 250 ms and under 0.1% server errors, with the availability target stated per month and the others over 30 days, and it says to tailor them.
- Availability: the Prometheus
upmetric for the Keycloak instances. - Latency:
http_server_requests_seconds_bucketagainsthttp_server_requests_seconds_count, filtered to login-related URIs. This needshttp-metrics-slosto include 250. - Errors:
http_server_requests_seconds_countwithoutcome="SERVER_ERROR". - Logins: user event metrics, with
realmas the default tag.
The guide recommends recording rules for production alerting. Details are in the Keycloak service level indicators guide.
What can a quiet Keycloak dashboard hide?
The docs point to several. Histograms are off by default, so latency panels stay empty until you enable them. User event counters are per instance and reset on restart. Tag cardinality is capped, and a green availability line says nothing about whether logins succeed.
- In a cluster, collect and aggregate metrics from every node for a cluster-wide view.
clientId,idpanderrortags are capped at 10,000 unique values by default; at the cap, no new tag-value metrics are created.- Adding
clientIdandidptags raises memory use, so Keycloak suggests it only for few clients and identity providers. - The database health check reports the connection pool, but the database guide shows the pool maximum is 100 by default, so size it deliberately.
If brokers such as RabbitMQ or Kafka authenticate through Keycloak, see token lifetimes and broker connections.
Where does AceMQ fit?
AceMQ supports Keycloak operations on community or Red Hat build installs, 24/7 across the Americas, EMEA and APAC, including help reviewing alert thresholds and probes. We do not sell Red Hat subscriptions, and defects in Red Hat's build go to Red Hat. For design work before production, see Keycloak consulting.
Sources
Frequently Asked Questions
What port does Keycloak expose metrics on?
The management interface, on port 9000 by default. Metrics are served at /metrics and health at /health. Change the port with http-management-port, and the docs advise keeping the management port unexposed outside your cluster.
Which Keycloak health endpoint should Kubernetes use for readiness?
Use /health/ready for readiness and load balancer checks. Use /health/started for the startup probe and /health/live for liveness. The health guide says the readiness endpoint should not decide container restarts.
Why is the Keycloak database health check missing?
The database check reports the connection pool status and requires metrics to be enabled at build time with --metrics-enabled=true. Without metrics enabled, the check is not available.
Talk to an engineer
Need a hand with Keycloak?
Senior engineers who run it in production. Get a quote or a free consultation, no sales pitch.

