Skip to content

Log Formats & Filters Reference

Starter
Professional

Glouton includes built-in log formats for common services. These can be referenced by name in file receivers, container configuration, or service definitions.

Built-in formats follow a naming convention:

  • {service} — for parsing host log files (e.g., nginx_access, redis)
  • {service}_docker — for parsing container logs (e.g., nginx_docker, redis_docker)
  • {service}_both — works with both host files and containers (e.g., nginx_both, apache_both)
ServiceHost FormatsContainer FormatsCombined
Nginxnginx_access, nginx_errornginx_both
Apacheapache_access, apache_errorapache_both
PostgreSQLpostgresqlpostgresql_docker
MySQLmysqlmysql_docker
Redisredisredis_docker
Valkeyvalkeyvalkey_docker
Kafkakafkakafka_docker
HAProxyhaproxyhaproxy_docker
MongoDBmongodbmongodb_docker
RabbitMQrabbitmqrabbitmq_docker
JSONjson
Go slogjson_golang_slog

Each built-in format provides:

  • Log parsing — extracts structured fields from log lines (e.g., HTTP method, status code, client IP)
  • Timestamp extraction — parses timestamps from log entries into the standard OpenTelemetry timestamp field
  • Severity mapping — maps service-specific severity levels (e.g., [error], WRN) to standard OpenTelemetry severity levels

Define custom log formats using the log.opentelemetry.known_log_formats setting. Each format is a list of Stanza operators.

log.opentelemetry.known_log_formats:
my_app_parser:
- type: json_parser
timestamp:
parse_from: attributes.time
layout: '%Y-%m-%dT%H:%M:%S.%L%z'
layout_type: strptime
severity:
parse_from: attributes.level
mapping:
debug: 'DBG'
info: 'INF'
warn: 'WRN'
error: 'ERR'
fatal: 'FTL'
- type: remove
field: attributes['some-attr']

In the above example, the timestamp and severity sections are optional settings of the json_parser operator. Similarly, inside the severity setting, the mapping field is optional.

Custom formats do not override the built-in defaults unless they share the same name.

Operators are based on Stanza’s operators. The full list of available types includes:

  • Parsers: json_parser, regex_parser, csv_parser, syslog_parser, key_value_parser
  • Transform: add, remove, move, copy, flatten, retain
  • Filter: filter
  • Router: router

See the Stanza operators documentation for the complete reference.

Define reusable log filters with log.opentelemetry.known_log_filters. These can be referenced by name in service or container configurations.

log.opentelemetry.known_log_filters:
min_level_info:
include:
match_type: strict
severity_number:
min: info
match_undefined: true

Global filters apply to all log sources: auto-discovered services, file receivers, container logs, and OTLP receivers. Configure them with log.opentelemetry.global_filters.

Drop matching log records using OpenTelemetry Transformation Language expressions:

log.opentelemetry.global_filters:
log_record:
- "Hour(Now()) < 7 or Hour(Now()) > 19"
log.opentelemetry.global_filters:
include:
match_type: strict
record_attributes:
- key: 'container.name'
value: 'app-01'
exclude:
match_type: regexp
severity_texts:
- 'debug'
- 'trace'

Both per-receiver filters and global filters support the same structure:

FieldDescription
log_recordList of OTTL expressions; matching records are dropped
include.match_typestrict (exact match) or regexp
include.resource_attributesMatch on resource attributes (key/value pairs)
include.record_attributesMatch on record attributes (key/value pairs)
include.severity_textsMatch on severity text values
include.severity_numberMatch on severity number (min, match_undefined)
include.bodiesMatch on log body content
excludeSame structure as include

Behavior notes:

  • All conditions within include or exclude use OR logic
  • Entries inside each section are also OR conditions
  • When both include and exclude are specified, include filtering occurs first