> ## Documentation Index
> Fetch the complete documentation index at: https://docs.golf.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Export Logs to OpenTelemetry

> Configure OTLP export for logs, metrics, and traces.

Configure OpenTelemetry (OTLP) export to send audit logs, metrics, and traces to any OTLP-compatible backend.

## Prerequisites

* Golf Gateway deployed and running
* OpenTelemetry Collector or compatible backend (Grafana, Datadog, etc.)

## Configure OTLP export

<Tabs>
  <Tab title="YAML">
    **gRPC (Recommended):**

    ```yaml theme={null}
    exporters:
      otel:
        - name: primary-otel
          enabled: true
          endpoint: otel-collector.example.com:4317
          protocol: grpc
          service_name: golf-gateway
          export_logs: true
          export_metrics: true
    ```

    **HTTP/Protobuf:**

    ```yaml theme={null}
    exporters:
      otel:
        - name: primary-otel
          enabled: true
          endpoint: https://otlp.example.com/v1/logs
          protocol: http/protobuf
          service_name: golf-gateway
          headers:
            Authorization: "Bearer ${OTEL_TOKEN}"
    ```
  </Tab>

  <Tab title="Admin Portal">
    1. Go to **Connections** > **Add Connection**
    2. Select **OpenTelemetry**
    3. Enter OTLP endpoint
    4. Select protocol (gRPC or HTTP)
    5. Configure which signals to export (logs, metrics, traces)
    6. Click **Test Connection**
    7. Click **Save**
  </Tab>
</Tabs>

## Export signals

| Signal  | YAML Field             | Description         |
| ------- | ---------------------- | ------------------- |
| Logs    | `export_logs: true`    | Audit log entries   |
| Metrics | `export_metrics: true` | Performance metrics |
| Traces  | `export_traces: true`  | Request traces      |

## Resource attributes

Golf Gateway includes these resource attributes:

| Attribute           | Value                     |
| ------------------- | ------------------------- |
| `service.name`      | From `service_name` field |
| `service.version`   | Gateway version           |
| `golf.gateway.id`   | Gateway ID (if managed)   |
| `golf.gateway.name` | Gateway name              |

Add custom attributes:

```yaml theme={null}
exporters:
  otel:
    - name: primary-otel
      # ... other fields
      resource_attributes:
        environment: production
        region: us-west-2
```

## Semantic conventions

Log records follow OpenTelemetry semantic conventions:

| Attribute             | Description  |
| --------------------- | ------------ |
| `event.name`          | Event type   |
| `http.request.method` | HTTP method  |
| `url.path`            | Request path |
| `mcp.method`          | MCP method   |
| `mcp.tool.name`       | Tool name    |

## Common OTLP backends

Consult your observability platform's documentation for OTLP endpoint configuration:

| Platform      | Documentation                                                                                                  |
| ------------- | -------------------------------------------------------------------------------------------------------------- |
| Grafana Cloud | [Send data via OTLP](https://grafana.com/docs/grafana-cloud/send-data/otlp/)                                   |
| Datadog       | [OpenTelemetry in Datadog](https://docs.datadoghq.com/opentelemetry/)                                          |
| New Relic     | [OpenTelemetry setup](https://docs.newrelic.com/docs/opentelemetry/get-started/opentelemetry-set-up-your-app/) |
| Honeycomb     | [OpenTelemetry overview](https://docs.honeycomb.io/send-data/opentelemetry/)                                   |

## Verify export is working

1. Check health endpoint includes OTEL status
2. View logs in your OTLP backend
3. Search for `service.name: golf-gateway`

## Troubleshooting

* **Connection timeout**: Verify endpoint is reachable
* **401/403 errors**: Check authentication headers
* **No data appearing**: Verify `export_logs: true` in your YAML config

## Related guides

* [Export Logs to Elasticsearch](/gateway/guides/audit-trail/export-to-elasticsearch) - ES export
* [Export Logs to Azure Sentinel](/gateway/guides/audit-trail/export-to-sentinel) - Sentinel export
