Skip to main content
Collect Kafka broker logs with the OpenTelemetry filelog receiver and send them to ClickHouse Observability. Use the demo dataset to try the integration without a Kafka deployment.

Prerequisites

  • A ClickHouse Observability service
  • Docker and curl
  • For your own logs, access to Kafka broker log files matching the format below

Connection details

Open ClickHouse Observability and go to Team Settings → Data → Managed Telemetry. Copy your OTLP HTTP endpoint and API key. You can use Copy connection details to copy the configuration, or Reveal key to view the masked key.For the OTLP exporter examples below, set these variables in the terminal where you will run the collector:
Replace the placeholders with the exact endpoint, including its port, and API key from your service. Use the base HTTP endpoint without a /v1/logs suffix; the exporter appends the signal path.
The endpoint must be reachable from the collector container. For a destination collector running on this computer, use http://host.docker.internal:4318. The Docker commands below include the host mapping.

Integration with existing Kafka

1

Verify Kafka logging configuration

Locate your broker logs. Common locations include $KAFKA_HOME/logs and /var/log/kafka, depending on your installation and logging configuration:
Common files are server.log (broker events), controller.log (controller events), and state-change.log (partition and replica transitions). Separate files exist only when configured in your logging appenders.The parser in this guide expects this Log4j text format:
If your broker logs only to stdout, configure a file appender in the broker’s logging configuration and share that directory with the collector. The filelog receiver does not read container stdout directly. Adjust the parser if your logging pattern differs.
2

Configure the collector

Save this as kafka-logs-monitoring.yaml:
Set location to the timezone used by your broker logs; the example assumes UTC. Multiline entries retain their complete stack traces. The collector reads new entries with start_at: end and normalizes severity text to lowercase.
3

Run the collector

Set the connection variables, then run from the configuration directory. Adjust the host log path if needed. For group-readable files, add --group-add LOG_GROUP_ID using the numeric group shown by ls -ln /var/log/kafka.
Leave the terminal open and generate broker activity that writes new log entries. Stop with Ctrl+C when finished testing.
4

Verify logs

Open Search, select Logs, filter for ServiceName:kafka-service, and select Last 15 minutes. You should see broker messages with parsed timestamps and severity.

Demo dataset

The sample contains 6,376 Kafka broker log entries spanning approximately 24 hours. The collector refreshes their timestamps while preserving messages and stack traces.
1

Download the sample

2

Configure the demo collector

Save this as kafka-logs-demo.yaml:
3

Run the demo collector

Set the connection variables, then run from the directory containing both files:
Leave the terminal open while verifying ingestion. Stop with Ctrl+C when finished. Running the demo again re-ingests the sample with refreshed timestamps.
4

Verify demo logs

Open Search, select Logs, filter for ServiceName:kafka-demo, and select Last 2 days.

Dashboards and visualization

1

2

Import the dashboard

  1. Open Dashboards and click Import in the upper-right corner.
  2. Upload kafka-logs-dashboard.json.
  3. Map the charts to your Logs source and click Finish Import.
3

View the dashboard

For the sample, optionally filter for ServiceName:kafka-demo and select Last 2 days. For your own logs, use ServiceName:kafka-service and a time range covering your records.

Troubleshooting

No logs appearing

Check the collector output for file permission, parsing, authentication, or export errors. Confirm your broker writes to the mounted directory and the filenames match the receiver’s include list. The live configuration reads new entries only.

Logs not parsing correctly

Compare a broker log entry with the expected format:
Adjust the regex and multiline start pattern if your logging format differs. Set the timestamp parser’s location to your broker’s logging timezone.

Next steps