Container Log Collection
Automatic Logs Collection
Section titled “Automatic Logs Collection”To enable collection of container logs, set
container_and_service_enable to true:
sudo tee /etc/glouton/conf.d/99-logs-containers.conf > /dev/null << 'EOF'log.opentelemetry.auto_discovery.container_and_service_enable: trueEOFThis 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.
Log Formats
Section titled “Log Formats”Specifying a log format for a container can be done in two ways:
Docker Labels / Kubernetes Annotations
Section titled “Docker Labels / Kubernetes Annotations”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.
Configuration File
Section titled “Configuration File”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_parserLog Filters
Section titled “Log Filters”Docker Labels / Kubernetes Annotations
Section titled “Docker Labels / Kubernetes Annotations”Known filters can be applied using the label or annotation:
docker run --label glouton.log_filter=my_app_filter [...]Configuration File
Section titled “Configuration File”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-filterGlobal Filters for Containers
Section titled “Global Filters for Containers”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'glouton.log_enable Label
Section titled “glouton.log_enable Label”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.