Send logs to OTLP receiver

Bonjour :waving_hand:

I continue loki’s adventures.

Today, I would like to send logs from apps to local alloy receiver and relay to another relay

+---------------------+       +---------------------+
|                     |       |                     |
|       VPS A         |       |       VPS B         |
|                     |       |                     |
| +-----------------+ |       | +-----------------+ |
| | Borgmatic       | |       | | Alloy           | |
| | (Docker)        | |       | | (Receiver)      | |
| +--------+--------+ |       | +--------+--------+ |
|          |          |       |          |          |
| +--------+--------+ |       | +--------+--------+ |
| | Alloy           | |       | | Loki            | |
| | (OTLP Sender)   | |       | | (Storage)       | |
| +-----------------+ |       | +-----------------+ |
+---------------------+       +---------------------+
        |                           |
        | OTLP (HTTP/Basic Auth)    |
        |-------------------------->|
       

On VPS A, Alloy configuration for logs:

otelcol.receiver.otlp "default" {
  http {
                endpoint = "0.0.0.0:4318"
  }

        grpc {
                endpoint = "0.0.0.0:4317"
        }
    output {
    metrics = [otelcol.processor.batch.default.input]
    logs    = [otelcol.processor.batch.default.input]
    traces  = [otelcol.processor.batch.default.input]
  }
}

otelcol.processor.batch "default" {

  output {
    metrics = [otelcol.exporter.otlphttp.default.input]
    logs    = [otelcol.exporter.otlphttp.default.input]
    traces  = [otelcol.exporter.otlphttp.default.input]
  }
}


otelcol.exporter.otlphttp "default" {
  client {
    endpoint = "http://receiver.domain.tld:4318"
    auth     = otelcol.auth.basic.default.handler
  }
  sending_queue {
    enabled = false
    num_consumers = 100
    queue_size = 10000
  }
}

otelcol.auth.basic "default" {
    username = "XXXX"
    password = "XXXXXXXXXXXXXX"
}

And borgmatic configuration for logs:

loki:
    url: http://localalloy:4318/v1/logs
    labels:
        app: borgmatic
        hostname: NAME_OF_DOCKER

When I launched borgmatic task, I have success log:

/etc/borgmatic.d/config.yml: http://localalloy:4318 "POST /v1/logs HTTP/1.1" 200 21

But nothing appears in livedebugging…

Alloy configuration on VPS B:

// OTLP RECEIVER RULES

otelcol.receiver.otlp "default" {
  http {
                endpoint = "0.0.0.0:4318"
    auth = otelcol.auth.basic.default.handler
  }

        grpc {
                endpoint = "0.0.0.0:4317"
    auth = otelcol.auth.basic.default.handler
        }
    output {
    metrics = [otelcol.processor.batch.default.input]
    logs    = [otelcol.processor.batch.default.input]
    traces  = [otelcol.processor.batch.default.input]
  }
}

otelcol.processor.batch "default" {

  output {
    metrics = [otelcol.exporter.prometheus.default.input]
    logs    = [otelcol.exporter.loki.default.input]
    traces  = [otelcol.exporter.otlphttp.tempo.input]
  }
}

loki.write "grafana_loki" {
  endpoint {
    url = "http://loki:3100/loki/api/v1/push"
  }
}

ON VPS B, I have a borgmatic docker and It’s works fine. I can see on Grafana.

I don’t know how to solve it.

Thanks