This page covers optional configuration for Docker container monitoring beyond the minimum setup. Currently, this is log collection.
Requirements
You can collect Docker container logs using the OpenTelemetry receiver creator with the Docker observer extension. Ensure you have the following:
- Read permissions on
/var/lib/docker/containers/for the collector process (root, or docker group membership) - Container ports exposed, so the receiver creator can discover and scrape container logs
Configure log collection
Configuration parameters
The following table describes the key configuration parameters for log collection:
| Parameter | Description |
|---|---|
endpoint (docker_observer) | Enter the path to the Docker socket the observer connects to. Default: unix:///var/run/docker.sock |
use_hostname_if_present | Set whether to use the container's hostname when available. Default: true |
poll_interval | Set how often the receiver checks log files for new lines. Default: 200ms |
start_at | Set where the receiver starts reading each log file. Use end to skip existing log lines and collect only new ones. |
Restart the collector
After updating the configuration, restart the collector to apply the changes.
Verify logs
Docker logs: Run this query:
FROM Log SELECT count(*) SINCE 10 minutes agoAdjust the WHERE clause to match your own log attributes.
Related articles
- Install and configure NRDOT Collector to monitor Docker: Minimum install, configuration, and verification steps
- Install and configure OpenTelemetry Collector Contrib to monitor Docker: Minimum install, configuration, and verification steps
- Docker metrics reference: Complete metric and attribute reference, with alerting recommendations