> For the complete documentation index, see [llms.txt](https://docs.bindplane.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bindplane.com/integrations/destinations/loki.md).

# Grafana Loki

Grafana Loki is a horizontally scalable, high-volume log aggregation system. The Grafana Loki destination exports logs from a Bindplane pipeline to a Loki instance using the OpenTelemetry Protocol (OTLP) over HTTP.

This destination supports **logs** only.

### Supported Telemetry

| Metrics | Logs | Traces |
| ------- | ---- | ------ |
|         | ✓    |        |

### Prerequisites

You need a reachable Loki OTLP endpoint and any credentials it requires.

* A running Grafana Loki instance reachable from your Bindplane collector, with OTLP ingestion enabled. The OTLP ingest path is exposed at `/otlp` (for example `http://<loki-host>:3100/otlp`). Loki completes the rest of the path automatically.
* Network connectivity from the collector to the Loki endpoint, including any firewall rules for the listening port (Loki defaults to `3100`).
* Authentication credentials, if the endpoint requires them. This destination supports HTTP basic authentication.
* TLS certificates, if the endpoint is served over HTTPS or requires mutual TLS.

For setup details see the [Grafana Loki OTLP ingestion guide](https://grafana.com/docs/loki/latest/send-data/otel/).

### Configuration

<figure><img src="/files/lRIL1df1HviWfWlIWRuB" alt="Bindplane docs - Grafana Loki - image 1"><figcaption></figcaption></figure>

**Endpoint**

| Parameter | Type   | Required | Default   | Description                                                            |
| --------- | ------ | -------- | --------- | ---------------------------------------------------------------------- |
| Endpoint  | String | Yes      | *(empty)* | Loki OTLP ingestion address, for example `http://localhost:3100/otlp`. |

**Authentication**

| Parameter      | Type    | Required | Default   | Description                                                                             |
| -------------- | ------- | -------- | --------- | --------------------------------------------------------------------------------------- |
| Use Basic Auth | Boolean | No       | `false`   | Enable HTTP basic authentication for the Loki endpoint.                                 |
| Username       | String  | Yes      | *(empty)* | Username for basic authentication. Shown when **Use Basic Auth** is enabled.            |
| Password       | String  | Yes      | *(empty)* | Password for basic authentication. Sensitive. Shown when **Use Basic Auth** is enabled. |

**Advanced**

| Parameter     | Type    | Required | Default | Description                                                                  |
| ------------- | ------- | -------- | ------- | ---------------------------------------------------------------------------- |
| Timeout       | Integer | Yes      | `30`    | Timeout, in seconds, for sending batches to the destination.                 |
| Drop Raw Copy | Boolean | No       | `true`  | When enabled, drops the raw copy of the log stored in `log.record.original`. |

**TLS**

| Parameter                         | Type    | Required | Default   | Description                                                                                                           |
| --------------------------------- | ------- | -------- | --------- | --------------------------------------------------------------------------------------------------------------------- |
| Enable TLS                        | Boolean | No       | `false`   | Configure advanced TLS settings.                                                                                      |
| Skip TLS Certificate Verification | Boolean | No       | `false`   | Skip TLS certificate verification. Shown when **Enable TLS** is enabled.                                              |
| TLS Certificate Authority File    | String  | No       | *(empty)* | Certificate authority used to validate TLS certificates. Shown when **Enable TLS** is enabled and verification is on. |
| Mutual TLS                        | Boolean | No       | `false`   | Use mutual TLS authentication. Shown when **Enable TLS** is enabled.                                                  |
| TLS Client Certificate File       | String  | No       | *(empty)* | TLS certificate used for client authentication. Shown when **Mutual TLS** is enabled.                                 |
| TLS Client Private Key File       | String  | No       | *(empty)* | TLS private key used for client authentication. Shown when **Mutual TLS** is enabled.                                 |

**Retry on Failure**

| Parameter               | Type    | Required | Default | Description                                                                                           |
| ----------------------- | ------- | -------- | ------- | ----------------------------------------------------------------------------------------------------- |
| Enable Retry on Failure | Boolean | No       | `true`  | Attempt to resend telemetry data that has failed to be transmitted to the destination.                |
| Initial Interval        | Integer | No       | `5`     | Time, in seconds, to wait after the first failure before retrying. Shown when retry is enabled.       |
| Max Interval            | Integer | No       | `30`    | The upper bound, in seconds, on backoff. Shown when retry is enabled.                                 |
| Max Elapsed Time        | Integer | No       | `300`   | Maximum time, in seconds, spent trying to send a batch before giving up. Shown when retry is enabled. |

**Sending Queue**

| Parameter                 | Type      | Required | Default                         | Description                                                                                                                    |
| ------------------------- | --------- | -------- | ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| Enable Sending Queue      | Boolean   | No       | `true`                          | Buffer telemetry data temporarily before sending so data is not lost during a temporary network outage.                        |
| Number of Consumers       | Integer   | No       | `10`                            | Number of consumers that dequeue batches. Shown when the sending queue is enabled.                                             |
| Queue Size                | Integer   | No       | `5000`                          | Maximum number of batches kept in memory before dropping. Shown when the sending queue is enabled.                             |
| Enable Persistent Queuing | Boolean   | No       | `true`                          | Buffer telemetry data to disk so data survives network outages or collector restarts. Shown when the sending queue is enabled. |
| Persistent Queue Storage  | Extension | Yes      | `file_storage_persistent_queue` | Storage to use for the persistent queue. Shown when the sending queue and persistent queuing are enabled.                      |

### Examples

#### Send logs to a local Loki instance

This destination sends logs to a Loki instance listening on the local host, with retry and an in-memory sending queue enabled.

```yaml
apiVersion: bindplane.observiq.com/v1
kind: Destination
metadata:
  name: loki
spec:
  type: loki_otlp
  parameters:
    - name: endpoint
      value: http://localhost:3100/otlp
    - name: drop_raw_copy
      value: true
    - name: retry_on_failure_enabled
      value: true
    - name: sending_queue_enabled
      value: true
    - name: persistent_queue_enabled
      value: false
```

#### Send logs over HTTPS with basic authentication and persistent queuing

This destination sends logs to a remote Loki endpoint over HTTPS, authenticates with basic auth, and buffers to disk so data survives collector restarts.

```yaml
apiVersion: bindplane.observiq.com/v1
kind: Destination
metadata:
  name: loki
spec:
  type: loki_otlp
  parameters:
    - name: endpoint
      value: https://loki.example.com/otlp
    - name: use_basic_auth
      value: true
    - name: basic_auth_username
      value: loki-user
    - name: basic_auth_password
      value: REPLACE_WITH_PASSWORD
    - name: configure_tls
      value: true
    - name: insecure_skip_verify
      value: false
    - name: ca_file
      value: /etc/ssl/certs/ca.crt
    - name: sending_queue_enabled
      value: true
    - name: persistent_queue_enabled
      value: true
    - name: persistent_queue_storage_extension
      value:
        type: file_storage_persistent_queue
        parameters:
          - name: persistent_queue_directory
            value: ${OIQ_OTEL_COLLECTOR_HOME}/storage
          - name: timeout
            value: 1
          - name: persistent_queue_fsync
            value: true
```

### Configuration Tips

* The endpoint must point at Loki's OTLP path. Use the form `http://<host>:<port>/otlp` (or `https://...`); Loki completes the remaining route. The default Loki port is `3100`.
* Keep **Drop Raw Copy** enabled to remove the `log.record.original` attribute and reduce storage. Disable it only when you need the original raw record for debugging.
* For mission-critical log delivery, enable the sending queue with persistent queuing so buffered batches survive collector restarts and network outages. Increase **Queue Size** and **Number of Consumers** for high-volume pipelines.

### Troubleshooting

**Logs are not delivered and the collector logs connection errors**

**Symptom:** Connection refused or timeout errors when exporting to Loki.

**Solution:** Confirm Loki is running and reachable from the collector. Verify the endpoint includes the `/otlp` path and the correct port (Loki defaults to `3100`), and check that firewall rules allow traffic to that port.

**The collector logs 401 Unauthorized**

**Symptom:** Authentication failures when sending to Loki.

**Solution:** Confirm **Use Basic Auth** is enabled and the username and password are correct. Ensure the credentials are sent over HTTPS, and verify that the Loki endpoint requires and accepts basic authentication.

**Logs are dropped during outages or after restarts**

**Symptom:** Log records are lost when Loki is briefly unreachable or the collector restarts.

**Solution:** Enable **Enable Retry on Failure** to handle transient errors, and enable the sending queue with **Enable Persistent Queuing** so batches are buffered to disk. Confirm the persistent queue storage directory exists with adequate disk space and write permissions.

### Standalone Destination

```yaml
apiVersion: bindplane.observiq.com/v1
kind: Destination
metadata:
  name: loki
spec:
  type: loki_otlp
  parameters:
    - name: endpoint
      value: http://localhost:3100/otlp
```

### Related Resources

* [OpenTelemetry Collector `otlphttp` exporter](https://github.com/open-telemetry/opentelemetry-collector/tree/main/exporter/otlphttpexporter)
* [Grafana Loki OTLP ingestion guide](https://grafana.com/docs/loki/latest/send-data/otel/)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.bindplane.com/integrations/destinations/loki.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
