Better Stack OpenTelemetry logging

Start logging in 5 minutes

Send logs and metrics to Better Stack using OpenTelemetry collector.

1. Install

Install latest OpenTelemetry collector:

Install OpenTelemetry collector
curl -sSL https://telemetry.betterstack.com/install/otelcol-contrib | sudo -E bash

2. Setup

Download OpenTelemetry configuration for your source:

Download OpenTelemetry config

sudo curl -L https://telemetry.betterstack.com/otel/$SOURCE_TOKEN -o /etc/otelcol-contrib/config.yaml

3. Restart

Restart OpenTelemetry collector for the new configuration to take effect:

Restart
sudo systemctl restart otelcol-contrib

You should see your logs in Better Stack → Live tail.

Check out your metrics in the OpenTelemetry dashboard.

No logs coming in?

Check the status and logs of OpenTelemetry collector:

Check OpenTelemetry collector
systemctl status otelcol-contrib
journalctl -u otelcol-contrib -n 20 -f

Already have OpenTelemetry collector running?

Update your existing collector configuration, and send metrics and logs from your receivers to Better Stack.

You can usually find the configuration in /etc/otelcol-contrib/config.yaml or otelcol-config.yml in your project.

Update your OpenTelemetry collector configuration
exporters:
  # Add exporters for Better Stack:
  otlp/betterstack:
    endpoint: "https://in-otel.logs.betterstack.com:443"
  prometheusremotewrite/betterstack:
    endpoint: "https://in-otel.logs.betterstack.com/metrics"

processors:
  # Add processors for Better Stack:
  batch:
  attributes/betterstack:
    actions:
      - key: better_stack_source_token
        value: $SOURCE_TOKEN
        action: insert

service:
  pipelines:
    # Add extra logs and metrics pipelines for Better Stack:
    metrics/betterstack:
      receivers: [hostmetrics, otlp] # your metrics receivers
      processors: [batch, attributes/betterstack]
      exporters: [prometheusremotewrite/betterstack]
    logs/betterstack:
      receivers: [otlp] # your logs receivers
      processors: [batch, attributes/betterstack]
      exporters: [otlp/betterstack]

Restart the OpenTelemetry collector for the new configuration to take effect.

Need help?

Please let us know at hello@betterstack.com.
We're happy to help! 🙏

Step-by-step video guide