A Docker Logging Driver plugin that forwards container logs to an OpenTelemetry (OTLP) Logs endpoint.
The host permission is required to use host level networking.
docker plugin install --disable --grant-all-permissions moritzloewenstein/otel-docker-logging-driver
docker plugin set moritzloewenstein/otel-docker-logging-driver \
OTEL_EXPORTER_OTLP_LOGS_ENDPOINT=http://localhost:4317 \
OTEL_EXPORTER_OTLP_LOGS_PROTOCOL=grpc \
OTEL_EXPORTER_OTLP_LOGS_INSECURE=true
docker plugin enable moritzloewenstein/otel-docker-logging-driverThe host permission is required to use host level networking.
docker plugin install --disable --grant-all-permissions moritzloewenstein/otel-docker-logging-driver
docker plugin set moritzloewenstein/otel-docker-logging-driver \
OTEL_EXPORTER_OTLP_LOGS_ENDPOINT=http://localhost:4318 \
OTEL_EXPORTER_OTLP_LOGS_PROTOCOL=http \
OTEL_EXPORTER_OTLP_LOGS_INSECURE=true
docker plugin enable moritzloewenstein/otel-docker-logging-driverIn /etc/docker/daemon.json:
{
"log-driver": "moritzloewenstein/otel-docker-logging-driver:latest",
"log-opts": {
"include-labels": "true"
}
}logging:
driver: moritzloewenstein/otel-docker-logging-driver:latest
options:
include-labels: "true"docker run --log-driver=moritzloewenstein/otel-docker-logging-driver:latest --log-opt include-labels=true nginxPlugin-level options (set via docker plugin set), defined in plugin/config.json:
-
OTEL_EXPORTER_OTLP_LOGS_ENDPOINT– OTLP logs endpoint (e.g.,http://localhost:4317orhttp://localhost:4318). -
OTEL_EXPORTER_OTLP_LOGS_PROTOCOL–grpcorhttp/protobuf. Default isgrpcfor backward compatibility. -
OTEL_EXPORTER_OTLP_LOGS_INSECURE– settrueto disable TLS when usinghttp. -
OTEL_EXPORTER_OTLP_LOGS_HEADERS– comma-separated headers,k=v,k2=v2. -
OTEL_EXPORTER_OTLP_LOGS_COMPRESSION– compression setting for gRPC (e.g.,gzip). -
TLS (file-based certificates, gRPC only):
OTEL_EXPORTER_OTLP_LOGS_CERTIFICATE– path to CA certificate PEM file enabling TLS. If unset, the genericOTEL_EXPORTER_OTLP_CERTIFICATEis used as a fallback. TLS creds are applied only when a CA certificate is provided (see the implementation in internal/otelx/otel.go).OTEL_EXPORTER_OTLP_LOGS_CLIENT_CERTIFICATE– optional path to client certificate PEM for mTLS.OTEL_EXPORTER_OTLP_LOGS_CLIENT_KEY– optional path to client private key PEM for mTLS.
Per-container options (set via --log-opt or compose logging.options), implemented in internal/driver/driver.go:
include-labels–true|1|yesto include container labels asdocker.label.<key>attributes.- Note: endpoint/headers overrides per container are not yet supported; the driver logs a warning if provided.
The plugin server exposes a Unix socket named otel-logs when started by Docker Plugin runtime.