bin/kc.[sh|bat] start --telemetry-endpoint=http://my-otel-endpoint:4317
OpenTelemetry (OTel) is an open-source observability framework designed to provide consistent and reliable ways to collect telemetry data across distributed systems. It is a project under the Cloud Native Computing Foundation (CNCF) as an incubating project. Its goal is to provide a unified standard and toolset for instrumenting, generating, and exporting telemetry data from modern applications, making it easier to monitor, debug, and understand complex services.
The goal of Keycloak is to support OpenTelemetry Logs, Metrics, and Traces to create a centralized observability stack without any additional deployment overhead.
Keycloak provides support for global settings of telemetry data export. It means that you can configure connection parameters to a single OpenTelemetry collector that will be used for all supported components.
In order to have OpenTelemetry enabled, at least one component needs to be turned on, for example Traces.
| The OpenTelemetry feature is enabled by default. Disable the feature in order to disable OpenTelemetry components. |
You can configure the OpenTelemetry collector’s global endpoint that is shared across all components by using the telemetry-endpoint option.
The default value is http://localhost:4317.
You can change the endpoint via CLI as follows:
bin/kc.[sh|bat] start --telemetry-endpoint=http://my-otel-endpoint:4317
You can configure the global OpenTelemetry service name used for identifying the exporter of the telemetry data.
The default service name is keycloak, specified via the telemetry-service-name property, which takes precedence over service.name defined in the telemetry-resource-attributes property.
You can change the service name via CLI as follows:
bin/kc.[sh|bat] start --telemetry-service-name=my-keycloak-iam
You can configure the global OpenTelemetry transport protocol used as a communication channel between Keycloak and the OpenTelemetry collector.
The default value is grpc.
Keycloak supports these communication protocols:
grpc (default)
http/protobuf
You can change the protocol via CLI as follows:
bin/kc.[sh|bat] start --telemetry-protocol=http/protobuf
You can override the global OpenTelemetry settings via the Tracing options if you want to export traces to a different OpenTelemetry collector.
|
OpenTelemetry Logs support is Preview and is not fully supported. This feature is disabled by default. To enable start the server with |
The OpenTelemetry feature (opentelemetry) needs to be turned on (by default).
|
It is possible to export Keycloak’s logs to the OpenTelemetry collector and be managed by various logging backends that support OpenTelemetry.
You can enable OpenTelemetry Logs via CLI as follows:
bin/kc.[sh|bat] start --features=opentelemetry-logs --telemetry-logs-enabled=true
For more information on how to set up logging, see the Configuring Logging guide.
By default, all log levels are exported by Keycloak.
You can optionally configure the most verbose log level to be exported via the telemetry-logs-level option.
For example, if you want only to export WARN and ERROR logs, you can change the log level via the CLI as follows:
bin/kc.[sh|bat] start --telemetry-logs-level=WARN
For development purposes, you can use the Grafana OTel-LGTM service, containing OpenTelemetry Collector and backends for logs (Loki), metrics (Prometheus), and traces (Tempo).
You can start the service by using Docker/Podman as follows:
docker run -p 3000:3000 -p 4317:4317 -p 4318:4318 --rm -ti grafana/otel-lgtm
Then, you can navigate to Grafana UI by accessing localhost:3000 and then you can explore all the data sent to OpenTelemetry Collector.
| Type or Values | Default | |
|---|---|---|
Available only when any of available OpenTelemetry components (Logs, Traces) is turned on |
String |
|
Available only when any of available OpenTelemetry components (Logs, Traces) is turned on |
|
|
Available only when any of available OpenTelemetry components (Logs, Traces) is turned on |
List |
|
Available only when any of available OpenTelemetry components (Logs, Traces) is turned on |
String |
|
| Type or Values | Default | |
|---|---|---|
Available only when 'opentelemetry' feature is enabled |
|
|
Available only when Tracing is enabled |
String |
|
Available only when Tracing is enabled |
|
|
Available only when Tracing is enabled DEPRECATED.
Resource attributes are not directly related to Tracing and you should use the Telemetry option which takes precedence. Use: |
List |
|
Available only when Tracing is enabled DEPRECATED.
Service name is not directly related to Tracing and you should use the Telemetry option which takes precedence. Use: |
String |
|
| Type or Values | Default | |
|---|---|---|
Available only when feature 'opentelemetry-logs:v1' is enabled |
|
|
Available only when Telemetry Logs functionality ('telemetry-logs-enabled') is enabled |
String |
|
Available only when Telemetry Logs functionality ('telemetry-logs-enabled') is enabled |
|
|
Available only when Telemetry Logs functionality ('telemetry-logs-enabled') is enabled |
|