# Syslog Messages

This guide shows you how to collect syslog messages and forward them to Sentry using the OpenTelemetry Collector with the [Syslog Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/syslogreceiver).

## [Prerequisites](https://docs.sentry.io/concepts/otlp/forwarding/sources/syslog.md#prerequisites)

Before you begin, ensure you have:

* Network access to receive syslog messages (TCP or UDP)
* A Sentry project to send data to

## [Step 1: Install the OpenTelemetry Collector](https://docs.sentry.io/concepts/otlp/forwarding/sources/syslog.md#step-1-install-the-opentelemetry-collector)

The Syslog Receiver is included in the [OpenTelemetry Collector Contrib](https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-contrib) distribution. You'll need to download and install this version, as the standard `otelcol` binary does not include the Syslog Receiver.

Download the latest `otelcol-contrib` binary from the [OpenTelemetry Collector releases page](https://github.com/open-telemetry/opentelemetry-collector-releases/releases).

## [Step 2: Get Your Sentry OTLP Credentials](https://docs.sentry.io/concepts/otlp/forwarding/sources/syslog.md#step-2-get-your-sentry-otlp-credentials)

You'll need your Sentry OTLP endpoint and authentication header. These can be found in your [Sentry Project Settings](https://sentry.io/settings/projects/) under **Client Keys (DSN)** > **OpenTelemetry (OTLP)**.

### [Logs Endpoint](https://docs.sentry.io/concepts/otlp/forwarding/sources/syslog.md#logs-endpoint)

```bash
___OTLP_LOGS_URL___
```

### [Authentication Header](https://docs.sentry.io/concepts/otlp/forwarding/sources/syslog.md#authentication-header)

```bash
x-sentry-auth: sentry sentry_key=___PUBLIC_KEY___
```

## [Step 3: Configure the Collector](https://docs.sentry.io/concepts/otlp/forwarding/sources/syslog.md#step-3-configure-the-collector)

Create a configuration file with the Syslog Receiver and the OTLP HTTP exporter configured to send logs to Sentry.

For additional configuration options like TLS, async processing, or custom attributes, see the [Syslog Receiver Documentation](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/syslogreceiver).

### [TCP Configuration (RFC 5424)](https://docs.sentry.io/concepts/otlp/forwarding/sources/syslog.md#tcp-configuration-rfc-5424)

This configuration receives syslog messages over TCP using the RFC 5424 format:

`config.yaml`

```yaml
receivers:
  syslog:
    tcp:
      listen_address: "0.0.0.0:514"
    protocol: rfc5424

processors:
  batch:
    send_batch_size: 1024
    send_batch_max_size: 2048
    timeout: "1s"

exporters:
  otlphttp/sentry:
    logs_endpoint: ___OTLP_LOGS_URL___
    headers:
      x-sentry-auth: "sentry sentry_key=___PUBLIC_KEY___"
    compression: gzip
    encoding: proto

service:
  pipelines:
    logs:
      receivers:
        - syslog
      processors:
        - batch
      exporters:
        - otlphttp/sentry
```

### [UDP Configuration (RFC 3164)](https://docs.sentry.io/concepts/otlp/forwarding/sources/syslog.md#udp-configuration-rfc-3164)

This configuration receives syslog messages over UDP using the older RFC 3164 (BSD syslog) format:

`config.yaml`

```yaml
receivers:
  syslog:
    udp:
      listen_address: "0.0.0.0:514"
    protocol: rfc3164
    location: UTC

processors:
  batch:
    send_batch_size: 1024
    send_batch_max_size: 2048
    timeout: "1s"

exporters:
  otlphttp/sentry:
    logs_endpoint: ___OTLP_LOGS_URL___
    headers:
      x-sentry-auth: "sentry sentry_key=___PUBLIC_KEY___"
    compression: gzip
    encoding: proto

service:
  pipelines:
    logs:
      receivers:
        - syslog
      processors:
        - batch
      exporters:
        - otlphttp/sentry
```

## [Configuring Syslog Sources](https://docs.sentry.io/concepts/otlp/forwarding/sources/syslog.md#configuring-syslog-sources)

After setting up the collector, configure your systems to send syslog messages to it.

### [Linux (rsyslog)](https://docs.sentry.io/concepts/otlp/forwarding/sources/syslog.md#linux-rsyslog)

Add the following to `/etc/rsyslog.conf` or create a file in `/etc/rsyslog.d/`:

`/etc/rsyslog.d/50-otel.conf`

```bash
# For TCP (RFC 5424)
*.* @@otel-collector-host:514

# For UDP (RFC 3164)
*.* @otel-collector-host:514
```

Then restart rsyslog:

```bash
sudo systemctl restart rsyslog
```

### [Linux (syslog-ng)](https://docs.sentry.io/concepts/otlp/forwarding/sources/syslog.md#linux-syslog-ng)

Add to your syslog-ng configuration:

```bash
destination d_otel {
    network("otel-collector-host" port(514) transport("tcp"));
};

log {
    source(s_sys);
    destination(d_otel);
};
```

## [Troubleshooting](https://docs.sentry.io/concepts/otlp/forwarding/sources/syslog.md#troubleshooting)

* Verify the syslog source is sending to the correct host and port
* Ensure firewall rules allow inbound traffic on the configured port
* Confirm the protocol setting matches your syslog source (RFC 3164 vs RFC 5424)

## [Additional Resources](https://docs.sentry.io/concepts/otlp/forwarding/sources/syslog.md#additional-resources)

* [Syslog Receiver Documentation](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/syslogreceiver)
* [Sentry OpenTelemetry Collector Configuration](https://docs.sentry.io/concepts/otlp/forwarding/pipelines/collector.md)
* [Sentry Logs](https://docs.sentry.io/product/explore/logs.md)
