Ingesting logs using Grafana Loki push API

You can receive logs from Grafana Agent or Promtail using the OpenTelemetry Collector Loki receiver and then export the data to Uptrace using the OpenTelemetry protocol.

OpenTelemetry Collector

OpenTelemetry Collectoropen in new window is a proxy service between your application and a distributed tracing toolopen in new window. Collector receives telemetry data, transforms the data, and then exports it to tracing tools that can store the data permanently.

Collector can also act as an agent that pulls telemetry data from monitored systems, for example, Redis or filesystem metrics.

Loki receiver

The Loki receiveropen in new window implements the Loki push apiopen in new window as specified hereopen in new window. It allows Promtail instances to specify the Open telemetry Collector as their lokiAddress.

To receive logs from Promtail and export them to Uptrace, add the following to your OpenTelemetry Collector configuration file:

receivers:
  loki:
    protocols:
      http:
      grpc:
    use_incoming_timestamp: true

exporters:
  otlp/uptrace:
    endpoint: otlp.uptrace.dev:4317
    headers:
      uptrace-dsn: 'https://token@api.uptrace.dev/project_id'

processors:
  batch:

service:
  pipelines:
    logs:
      receivers: [loki]
      processors: [batch]
      exporters: [otlp/uptrace]
receivers:
  loki:
    protocols:
      http:
      grpc:
    use_incoming_timestamp: true

exporters:
  otlp/uptrace:
    endpoint: http://localhost:14317
    tls:
      insecure: true
    headers:
      uptrace-dsn: 'http://project2_secret_token@localhost:14318?grpc=14317'

service:
  pipelines:
    logs:
      receivers: [loki]
      processors: [batch]
      exporters: [otlp/uptrace]

You can then configure Promtail to export data to OpenTelemetry Collector:

clients:
  - url: http://otelcol:3500/loki/api/v1/push
Last Updated: