Collect Logs with OpenTelemetry
A guide on how to collect logs using OpenTelemetry on Linux from installation to ingestion
Install otelcol-contrib
wget https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.120.0/otelcol-contrib_0.120.0_linux_amd64.debdpkg -i otelcol-contrib_0.121.0_linux_amd64.debwget https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.121.0/otelcol-contrib_0.121.0_linux_amd64.rpmrpm -ivh otelcol-contrib_0.121.0_linux_amd64.rpmConfigure Collector
receivers:
filelog:
include: ["<your_log_file_path>"]
multiline:
line_start_pattern: '^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3}'
processors:
batch:
timeout: 5s
exporters:
debug:
verbosity: detailed
otlphttp:
logs_endpoint: https://<your_domain>/v1/json_batch/otlplogs?namespace=<namespace>&application=<application>
encoding: json
compression: gzip
headers:
Authorization: "Bearer <your_token>"
tls:
insecure: false
insecure_skip_verify: true
service:
pipelines:
logs:
receivers: [filelog]
processors: [batch]
exporters: [debug, otlphttp]Validate and apply
Ascent view

Last updated
Was this helpful?