Snippets
OpenTelemetry Collector config snippets
Complete collector configs for the jobs people configure most, each with the one mistake that usually breaks it. Every config is a whole file, not a fragment, and passes the collector's own validate command (otelcol-contrib v0.161.0) before it is published.
No snippet matches.
Sources (27)
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 →Receive OTLP over gRPC and HTTP
The front door: accept OTLP from SDKs and other collectors, on both transports, for all three signals.
Logs · Metrics · Traces
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 →Collect host metrics (CPU, memory, disk, network, processes)
CPU, memory, disk, filesystem, network, load and per-process metrics from every host, without a separate node agent.
Metrics
Get the config →Read systemd journal logs (journald)
Ship systemd journal entries for the units you choose, at the priority you choose, instead of tailing files that do not exist.
Logs
Get the config →Scrape Prometheus metrics endpoints
Scrape any Prometheus /metrics endpoint - node_exporter, an application, an exporter - into OpenTelemetry metrics.
Metrics
Get the config →Receive StatsD metrics
Accept StatsD counters, gauges and timers from applications that already emit them, and send them on as OpenTelemetry metrics.
Metrics
Get the config →Receive logs from Fluent Bit and Fluentd (forward)
Take logs from existing Fluent Bit or Fluentd agents over the forward protocol, without replacing them first.
Logs
Get the config →Receive plain log lines over TCP
A raw TCP port for appliances and scripts that can only write lines to a socket.
Logs
Get the config →Receive log messages over UDP
A UDP port for senders that fire and forget log messages, one datagram per message.
Logs
Get the config →Check HTTP endpoints (synthetic availability)
Probe your HTTP endpoints from the collector and get status class, duration and error metrics per URL.
Metrics
Get the config →Check TCP ports (databases, caches)
Know when a database or cache port stops accepting connections, from the collector next to it.
Metrics
Get the config →Collect Kubernetes pod logs (DaemonSet)
Every container's logs from every node, with namespace, pod and container read from the log path - one DaemonSet, no sidecars.
Logs
Get the config →Collect node, pod and container metrics from the kubelet
CPU, memory, filesystem and network for every node, pod and container, read from the kubelet on each node.
Metrics
Get the config →Collect Kubernetes cluster metrics (one replica)
Deployment replicas, pod phases, node conditions, restarts and resource quotas from the Kubernetes API - one collector for the whole cluster.
Metrics
Get the config →Collect Kubernetes events as logs
Scheduling failures, image pull errors, OOM kills and probe failures as log records - kept after Kubernetes deletes the events.
Logs
Get the config →Scrape cAdvisor container metrics from the kubelet
The container_* metrics Kubernetes dashboards expect, scraped from each node's kubelet with the pod's service account token.
Metrics
Get the config →Scrape pods by prometheus.io annotations
Scrape every pod that asks for it with prometheus.io/scrape annotations, each node's collector only its own pods.
Metrics
Get the config →Collect Windows Event Log (Application, System, Security)
Application, System and Security events as structured logs - provider, event id, level, event data - without the rendered text twice over.
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 →Collect Windows performance counters (CPU, memory, disk)
CPU busy time, available memory and free space per volume from Windows performance counters, named the way you choose.
Metrics
Get the config →Processors (19)
memory_limiter and batch, in the right order
The two processors every pipeline needs, so a traffic spike neither kills the collector nor floods the backend.
Logs
Get the config →Mask PII in logs (e-mail, card numbers, IBAN, tokens, IPs)
Rewrite e-mail addresses, card numbers, IBANs, bearer tokens and IPs to placeholders on the collector, before the data leaves your network.
Logs
Get the config →Redact everything except an attribute allowlist
Turn masking around - name the attributes you keep, and the redaction processor removes everything else.
Logs
Get the config →Pseudonymise user IDs with a salted hash
Replace user.id with a salted SHA-256 on logs and spans - same user, same value, so per-user queries still join.
Logs · Traces
Get the config →Drop sensitive attributes before export
Delete named attributes, and every captured HTTP request header, from logs, spans and metrics before they are exported.
Logs · Metrics · Traces
Get the config →Enforce required resource attributes (semantic conventions)
Refuse telemetry that cannot be attributed - drop anything without service.name, service.namespace and deployment.environment.name.
Logs · Metrics · Traces
Get the config →Drop health-check logs and spans
Stop paying to store Kubernetes probe traffic: drop /healthz, /readyz and /livez logs and spans on the collector.
Logs · Traces
Get the config →Keep only error logs
Ship only ERROR and FATAL log records from a noisy source, and drop the rest on the collector.
Logs
Get the config →Filter logs by severity (WARN and above)
Drop DEBUG and INFO on the collector, without silently losing the logs that never set a severity.
Logs
Get the config →Drop all telemetry from a service
Drop everything a load generator or synthetic probe sends, by service.name, across logs, metrics and traces.
Logs · Metrics · Traces
Get the config →Sample traces probabilistically (head sampling)
Keep a fixed share of traces, decided by trace ID, so every collector keeps the same traces whole.
Traces
Get the config →Tail sampling: keep every error and slow trace
Decide after the trace is complete: keep every failed or slow trace, and only a small share of the healthy ones.
Traces
Get the config →Reduce metric cardinality (aggregate away per-request attributes)
Strip user and request IDs from metric attributes and sum the points that collapse together, so one series per route remains.
Metrics
Get the config →Drop the collector's own metrics
Keep the collector's own otelcol_* metrics out of the application metrics you pay to store.
Metrics
Get the config →Deduplicate repeated log records
Collapse a burst of identical errors into one record with a count, instead of storing it a thousand times.
Logs
Get the config →Add Kubernetes pod, namespace and deployment to telemetry
Tag every log, metric and span with the namespace, pod, deployment and node it came from.
Logs · Metrics · Traces
Get the config →Detect host and cloud resource attributes
Fill in host, environment and cloud resource attributes on the collector - without overwriting what the SDK already set.
Logs · Metrics · Traces
Get the config →Set resource attributes the sender left out
Stamp environment and namespace onto telemetry at the collector, without overwriting what an SDK already set.
Logs · Metrics · Traces
Get the config →Rename old HTTP attributes to current semantic conventions
Move http.method, http.status_code and http.target to the current names, so old and new services land in the same dashboards.
Logs · Traces
Get the config →Destinations (18)
Prove data is flowing with the debug exporter
The first thing to reach for when nothing arrives: print what the collector actually receives.
Logs
Get the config →Send logs and traces to Elasticsearch
Logs and traces into Elasticsearch, in the OpenTelemetry-native mapping, with the API key from the environment.
Logs · Traces
Get the config →Send OTLP over gRPC (with headers and TLS)
Forward everything over OTLP/gRPC to a backend or another collector, with a tenant header, compression, a queue and retries.
Logs · Metrics · Traces
Get the config →Send to Grafana Cloud over OTLP
Logs, metrics and traces to Grafana Cloud's OTLP gateway, authenticated with your instance ID and token from the environment.
Logs · Metrics · Traces
Get the config →Send metrics with Prometheus remote write
Metrics into Prometheus, Mimir, Thanos or any remote-write store, with resource attributes as labels you can query.
Metrics
Get the config →Send logs to Loki over native OTLP
Logs into Loki through its native OTLP endpoint - the way that still works in current collectors.
Logs
Get the config →Send to Datadog
Logs, metrics and traces to Datadog, with the API key from the environment and a queue in front of the exporter.
Logs · Metrics · Traces
Get the config →Send to Splunk over HEC
Logs and metrics into Splunk through the HTTP Event Collector, with index and sourcetype set and the token from the environment.
Logs · Metrics
Get the config →Send to Kafka (per-signal topics)
Buffer telemetry in Kafka, one topic per signal, OTLP protobuf encoded, zstd compressed.
Logs · Metrics · Traces
Get the config →Write telemetry to a file (JSON lines, rotated)
Write everything to a rotated JSON-lines file, for debugging, air-gapped hand-over or a quick replay.
Logs · Metrics · Traces
Get the config →Store telemetry in ClickHouse
Logs, traces and metrics into ClickHouse tables the exporter creates for you, expired by TTL.
Logs · Metrics · Traces
Get the config →Archive telemetry to S3 (gzip, time-partitioned)
Cheap long-term retention: every batch as a gzipped OTLP JSON object under a year/month/day/hour/minute prefix.
Logs · Metrics · Traces
Get the config →Send to Azure Monitor (Application Insights)
Logs, metrics and traces to Application Insights, authenticated by the connection string from the environment.
Logs · Metrics · Traces
Get the config →Send to Google Cloud (Logging, Monitoring, Trace)
Logs, metrics and traces into Cloud Logging, Cloud Monitoring and Cloud Trace, with GCP resource attributes detected.
Logs · Metrics · Traces
Get the config →Send to Honeycomb over OTLP
Traces, logs and metrics into Honeycomb over OTLP, with the team API key from the environment.
Logs · Metrics · Traces
Get the config →Send to New Relic over OTLP
Logs, metrics and traces to New Relic's OTLP endpoint, license key from the environment, EU region.
Logs · Metrics · Traces
Get the config →Send to Dynatrace over OTLP (delta metrics)
Logs, traces and metrics to Dynatrace's OTLP API, with cumulative counters converted to the delta temporality it requires.
Logs · Metrics · Traces
Get the config →Send logs and traces to OpenSearch
Logs and traces into OpenSearch with its own exporter - not the elasticsearch one.
Logs · Traces
Get the config →Pipelines (10)
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 →Kubernetes pod logs to Loki, enriched with deployment and cluster
Every pod's logs into Loki over OTLP, labelled with namespace, pod, container, deployment, node and cluster.
Logs
Get the config →Firewall syslog to a SIEM, with PII masked
Firewall and VPN syslog into the SIEM with user names pseudonymised and e-mail addresses masked - IPs kept for correlation.
Logs
Get the config →Agents to a gateway tier, load-balanced by trace ID
Agents route every span of a trace to the same gateway, so tail sampling on the gateways sees complete traces.
Traces
Get the config →Buffer through a backend outage with a persistent queue
Keep what arrives while the backend is down on disk, and deliver it when the backend is back - even if the collector restarts in between.
Logs · Traces
Get the config →Route logs to different backends by attribute (routing connector)
One collector, several backends: the payments team's logs go to their store, everything else to the central one.
Logs
Get the config →RED metrics from traces (spanmetrics connector) to Prometheus
Request rate, errors and latency per service and endpoint, computed from the spans you already send - no metrics SDK needed.
Metrics · Traces
Get the config →Count error logs per service as a metric (count connector)
Alert on error rates without storing the logs: count them in the collector and keep only the counter.
Logs · Metrics
Get the config →Prometheus counters to a delta-only backend (cumulativetodelta)
Scrape Prometheus counters and convert them to the delta temporality Dynatrace requires - gauges untouched.
Metrics
Get the config →Windows event logs, reduced: noisy events dropped, rendered text removed
Windows events with the structured fields kept, the duplicated rendered text removed and the chattiest event IDs dropped.
Logs
Get the config →Running more than one collector?
LinkMesh manages collector configuration across a fleet from one self-hosted control plane, with a built-in library of sources you activate instead of hand-editing YAML on every host.
Install LinkMesh →