Parse logs with the OpenTelemetry Collector (10)
A log line only becomes useful once its fields are fields: a timestamp the backend can sort on, a severity it can filter on, the status code and path as attributes instead of one long string.
These configs parse JSON, key-value pairs, nginx, Apache and IIS access logs and syslog, and set the timestamp and severity from the line itself. Each shows the input line, the config and the parsed record. For multiline events and the messier cases, read our guide to parsing messy logs.
Tail a log file
Ship an application log file to your backend, and keep your place in it across collector restarts.
Logs
Get the config →Receive syslog (RFC 5424 and RFC 3164)
Accept modern and legacy syslog on one collector, from network gear and hosts that speak nothing else.
Logs
Get the config →Parse JSON log lines into attributes
Turn each JSON log line into attributes you can filter and group by, keeping the original line as the body.
Logs
Get the config →Parse nginx access logs into semantic conventions
Turn nginx combined-format access log lines into OpenTelemetry semantic-convention attributes, with typed status codes.
Logs
Get the config →Parse Apache access logs into semantic conventions
Turn Apache combined-format access log lines into semantic-convention attributes, with typed status codes and sizes.
Logs
Get the config →Parse key=value log lines
Turn logfmt-style key=value lines into attributes, quoted values with spaces included.
Logs
Get the config →Use the timestamp in the log line, in the right time zone
Stamp each record with the time written in the line, not the time the collector read it - in the zone it was written in.
Logs
Get the config →Map your log levels to OpenTelemetry severity
Set severity_number from your level field, including names like warning, err and crit, so severity filters work.
Logs
Get the config →Parse IIS W3C access logs into semantic conventions
Every IIS request as a structured log: method, path, query, status, sizes, time taken and user agent, with the request's own UTC timestamp.
Logs
Get the config →nginx access logs to Elasticsearch, parsed into semantic conventions
Tail nginx, parse every request into semantic-convention fields with typed status codes, and index it in Elasticsearch.
Logs
Get the config →