Skip to content

Container Log Collection

Starter
Professional

To enable collection of container logs, set container_and_service_enable to true:

Terminal window
sudo tee /etc/glouton/conf.d/99-logs-containers.conf > /dev/null << 'EOF'
log.opentelemetry.auto_discovery.container_and_service_enable: true
EOF

This option is also enabled when using all_enable.

Once enabled, Glouton automatically gathers logs from all Docker and Kubernetes containers. Use the controls below to apply formats, filters, or disable collection for specific containers.

Specifying a log format for a container can be done in two ways:

Use a container label or pod annotation:

docker run --label glouton.log_format=my_app_parser [...]

See this section for more information about labels and annotations.

If you can’t set container labels or pod annotations, use the container_format setting with the container name:

log.opentelemetry.container_format:
my-app-ctr: my_app_parser

Known filters can be applied using the label or annotation:

docker run --label glouton.log_filter=my_app_filter [...]

A mapping between the container name and the known filter can be defined using the container_filter setting:

log.opentelemetry.container_filter:
app-01: app-filter

Filters can also be applied globally with global filters.

For example, to only keep logs from a specific container:

log.opentelemetry.global_filters:
include:
match_type: strict
record_attributes:
- key: 'container.name'
value: 'app-01'

Disable log processing for a specific container, or enable it even when automatic discovery is not active:

docker run --label glouton.log_enable=false [...]
docker run --label glouton.log_enable=true [...]

This label works with both Docker labels and Kubernetes annotations.