---
title: How to send metrics or logs to Cockpit using OTLP
description: Learn how to send metrics or logs to Cockpit using OTLP exporters, either with a vanilla OTLP exporter or Grafana Alloy.
tags: cockpit observability otlp metrics logs push-metrics push-logs
dates:
  validation: 2026-07-06
  posted: 2026-07-06
---
import Requirements from '@macros/iam/requirements.mdx'

This guide explains how to configure OpenTelemetry Protocol (OTLP) to push your metrics and logs to Cockpit. You can choose between using a vanilla OTLP exporter or Grafana Alloy as your metrics collector and forwarder.


<Requirements />

  - [Owner](/iam/concepts/#owner) status or [IAM permissions](/iam/concepts/#permission) allowing you to perform actions in the intended Organization
  - A Scaleway account logged into the [console](https://console.scaleway.com)
  - A [token](/cockpit/how-to/create-token/) with push permissions for metrics and/or logs in the **same region as your data**
  - For vanilla OTLP: 
    - An OTLP-compatible exporter installed on your system (e.g., OpenTelemetry Collector, otelcol)
    - Your metrics or logs endpoint URLs retrieved from the [Data sources tab](https://console.scaleway.com/cockpit/dataSource) of the Scaleway console

    <Message type="note">
    Cockpit supports both metrics and logs ingestion via OTLP. Use the following endpoints based on your data source region:
    - **Metrics endpoint**: `https://<your-resource-id>.metrics.cockpit.<region>.scw.cloud/otlp/v1/metrics`
    - **Logs endpoint**: `https://<your-resource-id>.logs.cockpit.<region>.scw.cloud/otlp/v1/logs`
    </Message>

  - For Grafana Alloy: [Installed Grafana Alloy](https://grafana.com/docs/alloy/latest/get-started/install/)

<Message type="important">
 - If you keep the agents at their default configuration, they may transmit a larger set of resource metrics, which can increase consumption and drive up costs.

 - Sending metrics and logs for Scaleway resources or personal data using an external path is a billable feature. Any data that you push yourself is billed, even if you send data from Scaleway products. Refer to the [product pricing](https://www.scaleway.com/en/pricing/managed-services/#cockpit) for more information.
</Message>

## Using a Vanilla OTLP Exporter

This section demonstrates how to configure a standard OTLP exporter to send metrics directly to Cockpit.



1. Install the OpenTelemetry Collector on your system. For example, on macOS using Homebrew:
   ```bash
   brew install open-telemetry/opentelemetry-collector/opentelemetry-collector
   ```

2. Create a configuration file named `otel-collector-config.yaml`:
   ```yaml
   receivers:
     otlp:
       protocols:
         grpc:
           endpoint: 0.0.0.0:4317
         http:
           endpoint: 0.0.0.0:4318

   processors:
     batch:
       timeout: 10s
       send_batch_size: 1024

   exporters:
     otlphttp/cockpit-metrics:
       endpoint: "https://xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.metrics.cockpit.fr-par.scw.cloud/otlp/v1/metrics"
       headers:
         X-TOKEN: "COCKPIT_TOKEN_SECRET_KEY"
     otlphttp/cockpit-logs:
       endpoint: "https://xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.logs.cockpit.fr-par.scw.cloud/otlp/v1/logs"
       headers:
         X-TOKEN: "COCKPIT_TOKEN_SECRET_KEY"

   service:
     pipelines:
       metrics:
         receivers: [otlp]
         processors: [batch]
         exporters: [otlphttp/cockpit-metrics]
       logs:
         receivers: [otlp]
         processors: [batch]
         exporters: [otlphttp/cockpit-logs]
   ```

3. Replace the following values:
   - `https://xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.metrics.cockpit.fr-par.scw.cloud/otlp/v1/metrics` with your metrics endpoint URL
   - `https://xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.logs.cockpit.fr-par.scw.cloud/otlp/v1/logs` with your logs endpoint URL (optional, if sending logs)
   - `COCKPIT_TOKEN_SECRET_KEY` with your Cockpit token's secret key

   <Message type="important">
     Make sure that your token and your data sources (metrics and/or logs) were both created in the same region.
   </Message>

   <Message type="note">
     You can configure both metrics and logs pipelines to send data to Cockpit. Each data type requires its own endpoint:
     - Metrics: `/otlp/v1/metrics`
     - Logs: `/otlp/v1/logs`
   </Message>

4. Start the OpenTelemetry Collector:
   ```bash
   otelcol --config otel-collector-config.yaml
   ```

5. Configure your applications to send metrics and logs to the collector:
   - **gRPC endpoint**: `localhost:4317`
   - **HTTP endpoint**: `localhost:4318`

   Your applications can send both metrics and logs to the same collector endpoints, which will forward them to the appropriate Cockpit endpoints based on the pipeline configuration.

## Using Grafana Alloy

Grafana Alloy provides a flexible way to collect, transform, and forward metrics to Cockpit with built-in scraping capabilities.

<Message type="note">
  For this guide, we are using Grafana Alloy on macOS. Refer to the [official Grafana documentation](https://grafana.com/docs/alloy/latest/get-started/) to find the commands for your operating system.
</Message>


1. Create a folder named `config` on your local machine.

2. Inside the `config` folder, create a file named `cockpit.alloy`.

3. Paste the following template inside `cockpit.alloy`:
   ```alloy
   prometheus.exporter.unix "node" {
       set_collectors = [
           "uname",
           "cpu",
           "cpufreq",
           "loadavg",
           "meminfo",
           "filesystem",
           "netdev",
       ]
   }

   prometheus.scrape "node" {
       scrape_interval = "60s"
       scrape_timeout  = "4s"

       targets    = prometheus.exporter.unix.node.targets
       forward_to = [prometheus.remote_write.cockpit.receiver]
   }

   prometheus.remote_write "cockpit" {
       endpoint {
           url = "https://xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.metrics.cockpit.fr-par.scw.cloud/otlp/v1/metrics"
           headers = {
               "X-TOKEN" = "COCKPIT_TOKEN_SECRET_KEY",
           }
       }
   }

   // Optional: Configure logs exporter
   // otelcol.exporter.otlphttp "cockpit_logs" {
   //     client {
   //         endpoint = "https://xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.logs.cockpit.fr-par.scw.cloud/otlp/v1/logs"
   //         headers = {
   //             "X-TOKEN" = "COCKPIT_TOKEN_SECRET_KEY",
   //         }
   //     }
   // }
   ```

4. Replace the following values:
   - `https://xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.metrics.cockpit.fr-par.scw.cloud/otlp/v1/metrics` with your metrics endpoint URL from the [Data sources tab](https://console.scaleway.com/cockpit/dataSource)
   - `COCKPIT_TOKEN_SECRET_KEY` with your Cockpit token's secret key
   - (Optional) Uncomment and configure the logs exporter with your logs endpoint: `https://xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.logs.cockpit.fr-par.scw.cloud/otlp/v1/logs`

   <Message type="important">
     Make sure that your token and your data sources (metrics and/or logs) were both created in the same region.
   </Message>

   <Message type="note">
     Grafana Alloy can send both metrics and logs to Cockpit. The example above shows metrics configuration using Prometheus remote_write. To send logs, uncomment the OTLP HTTP exporter configuration and configure your log collection components to forward to it.
     - Metrics endpoint: `/otlp/v1/metrics`
     - Logs endpoint: `/otlp/v1/logs`
   </Message>

5. Open a terminal and [start Alloy](https://grafana.com/docs/alloy/latest/get-started/run/). For example, on macOS:
   ```bash
   brew services start alloy
   ```

6. In the same terminal, run the following command:
   ```bash
   alloy run config/cockpit.alloy
   ```

   The last lines of your output should look similar to the following:
   ```
   ts=2026-01-23T14:23:05.542081Z level=info msg="now listening for http traffic" service=http addr=127.0.0.1:12345
   ts=2026-01-23T14:23:13.432896Z level=info msg="Done replaying WAL" component_path=/ component_id=prometheus.remote_write.cockpit subcomponent=rw remote_name=aa0551 url=https://xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.metrics.cockpit.fr-par.scw.cloud/otlp/v1/metrics duration=12.900498616s
   ```

## Visualizing your metrics

1. Click **Cockpit** in the **Monitoring** section of the [console](https://console.scaleway.com/) side menu. The **Cockpit** overview page displays.

2. Click **Access Grafana** to open your preconfigured dashboards in Grafana. You are redirected to the Grafana website.

3. Click the Grafana icon in the top left side of your screen to open the menu.

4. Click **Dashboards**, then click **New** in the top right corner of your screen. A drop-down displays.

5. Click **Import** to import a dashboard.

6. In the **Import via grafana.com** field, enter `1860`, then click **Load**.

   <Message type="note">
     `1860` is the ID of the [Node Exporter Full dashboard](https://grafana.com/grafana/dashboards/1860-node-exporter-full/) provided by Grafana.
   </Message>

8. Enter a name for your dashboard or leave the default one.

9. In the **Folder** field, select a folder in which to store your dashboard.

10. In the **Prometheus** field, select your metrics data source from the drop-down.

11. Click **Import**. Your dashboard should load and display.

12. In the drop-down next to **Datasource**, select your metrics data source. By default, your dashboard retrieves your data source's data from the last 24 hours.

13. If your data source was created less than 24 hours ago, click the clock icon and adjust the time range to match its creation time.

Your dashboard should now display your metrics collected via OTLP.

## Viewing logs

To view logs sent to Cockpit:

1. Click **Cockpit** in the **Monitoring** section of the [console](https://console.scaleway.com/) side menu.

2. Click **Access Grafana** to open Grafana.

3. Navigate to **Explore** in the left menu.

4. Select your logs data source from the drop-down.

5. Use LogQL queries to filter and analyze your logs.
