Setup with Docker Compose
1. Add the OTel Collector
Add the collector to yourdocker-compose.yml:
2. Configure the Collector
Createotel-config.yaml:
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Collect errors and logs from Docker containers using OpenTelemetry Collector.
docker-compose.yml:
# docker-compose.yml
services:
otel-collector:
image: otel/opentelemetry-collector-contrib:latest
volumes:
- ./otel-config.yaml:/etc/otelcol-contrib/config.yaml
- /var/lib/docker/containers:/var/lib/docker/containers:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
ports:
- "4317:4317" # gRPC
- "4318:4318" # HTTP
restart: unless-stopped
# Your existing services...
web:
image: your-app
logging:
driver: json-file # Default Docker logging driver
otel-config.yaml:
# otel-config.yaml
receivers:
filelog/docker:
include:
- /var/lib/docker/containers/*/*.log
operators:
- type: json_parser
timestamp:
parse_from: attributes.time
layout: "%Y-%m-%dT%H:%M:%S.%LZ"
- type: move
from: attributes.log
to: body
- type: move
from: attributes.stream
to: attributes["log.iostream"]
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
http:
endpoint: 0.0.0.0:4318
exporters:
otlphttp/squasher:
endpoint: https://ingest.squasher.ai
headers:
x-squasher-key: "sq_pk_your_api_key"
processors:
batch:
timeout: 5s
send_batch_size: 100
service:
pipelines:
logs:
receivers: [filelog/docker, otlp]
processors: [batch]
exporters: [otlphttp/squasher]
traces:
receivers: [otlp]
processors: [batch]
exporters: [otlphttp/squasher]
docker compose up -d
Configure Docker logs for Squasher project <project_id>. Add or update the OpenTelemetry Collector config, keep the x-squasher-key value in environment or secret storage, run the collector config validation if available, and verify with one container error log.