Documentation forSolarWinds Observability SaaS

Forward Docker logs (Papertrail)

There are two methods available for shipping container logs from a Docker host to Papertrail. Pick the method that matches how your apps log:

To get a destination and token in Papertrail, add a new log destination. The ingestion token is generated along with the destination. Use the collector endpoints for your account's region:

  • Syslog (TLS): syslog.collector.<REGION>.cloud.solarwinds.com:6514

  • HTTPS: https://logs.collector.<REGION>.cloud.solarwinds.com/v1/logs/bulk

Replace <REGION> with the data center your organization uses: na-01, eu-01, or ap-01.

Option A: Forward container stdout/stderr with logspout

logspout is a small, stateless container that attaches to the Docker socket. It collects stdout/stderr from your other containers and forwards it over TLS syslog. This is the fastest path for standard containerized apps. Because it sends syslog, each container is attributed correctly—System = host, Program = container—with no extra config.

Docker run

Run the following command in the terminal of your Docker host:

  docker run -d \
  --name logspout \
  --restart=unless-stopped \
  --volume=/var/run/docker.sock:/var/run/docker.sock \
  -e SYSLOG_STRUCTURED_DATA='solarwinds@41058 token="<SWO_TOKEN>"' \
  -e SYSLOG_HOSTNAME="{{.Container.Config.Hostname}}" \
  gliderlabs/logspout \
  syslog+tls://syslog.collector.<REGION>.cloud.solarwinds.com:6514

Docker Compose

Run the following command in the terminal of your Docker host:

services:
  logspout:
    image: gliderlabs/logspout
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      SYSLOG_STRUCTURED_DATA: 'solarwinds@41058 token="<SWO_TOKEN>"'
      SYSLOG_HOSTNAME: "{{.Container.Config.Hostname}}"
    command: syslog+tls://syslog.collector.<REGION>.cloud.solarwinds.com:6514
    restart: unless-stopped

Notes

  • Set SYSLOG_HOSTNAME so logs show a readable source name instead of the container ID.

  • For multi-line events (such as stack traces), use the multiline+syslog+tls://... prefix on the destination URL.

  • logspout collects stdout/stderr only. It does not read log files written inside a container. For file tailing, use Option B: Full coverage with Fluent Bit.

  • See the logspout README for Swarm, environment variables, and filtering options.

Option B: Full coverage with Fluent Bit

Fluent Bit is a collector that can tail both container stdout/stderr and log files inside containers (via Docker volumes or bind mounts), then forward to Papertrail over HTTPS. Use this option when you need file collection, on-disk buffering, retries, or per-source enrichment.

The following examples use a Docker volume (service-logs) for file tailing and a dedicated directory (state) to persist Fluent Bit's internal state across restarts.

Single-host/single-service setup

fluent-bit.conf

Create a file named fluent-bit.conf on your Docker host with the following contents:

[SERVICE]
    Flush             2
    Log_Level         info
    Parsers_File      /fluent-bit/etc/parsers.conf

# Read Docker stdout/stderr
[INPUT]
    Name              tail
    Path              /var/lib/docker/containers/*/*-json.log
    Parser            docker
    Tag               myapp
    DB                /fluent-bit/state/docker.db

# Read application log files
[INPUT]
    Name              tail
    Path              /logs/*.log
    Tag               myapp
    DB                /fluent-bit/state/files.db

# Send everything to the collector
[OUTPUT]
    Name              http
    Match             *
    Host              logs.collector.<REGION>.cloud.solarwinds.com
    Port              443
    URI               /v1/logs/bulk
    Format            json_lines
    json_date_key     timestamp
    json_date_format  iso8601
    Mode              tls
    tls.verify        On
    Header            Authorization Bearer ${SWO_TOKEN}
    Header            X-Otel-Resource-Attr host.name=my-host,service.name=my-service

Notes:

  • Use the /v1/logs/bulk endpoint with the json_lines format for newline-batched payloads.

  • Combine multiple resource attributes into a single comma-delimited X-Otel-Resource-Attr header.

  • On a single Docker host, set host.name once in the header. Since every container shares the host, it correctly fills System for every container.

Docker run

Run the following command in the terminal of your Docker host:

docker run -d \
  --name fluent-bit \
  --restart unless-stopped \
  --volume=./fluent-bit.conf:/fluent-bit/etc/fluent-bit.conf:ro \
  --volume=./state:/fluent-bit/state \
  --volume=/var/lib/docker/containers:/var/lib/docker/containers:ro \
  --volume=service-logs:/logs:ro \
  fluent/fluent-bit:latest

Docker Compose

Run the following command in the terminal of your Docker host:

services:
  myapp:
    volumes:
      - service-logs:/logs

  fluent-bit:
    image: fluent/fluent-bit:latest
    volumes:
      - ./fluent-bit.conf:/fluent-bit/etc/fluent-bit.conf
      - ./state:/fluent-bit/state
      - /var/lib/docker/containers:/var/lib/docker/containers:ro
      - service-logs:/logs:ro
    restart: unless-stopped

volumes:
  service-logs:

Excluding Fluent Bit's own logs

The example above also forwards Fluent Bit's own logs to Papertrail. If you want to prevent this from happening, you have the following options:

  • Do not produce logs at all. Start the container with --log-driver=none.

  • Produce logs in a different style. Start the container with --log-driver=syslog.

  • Produce and forward only warnings and errors. Use Log_level warn in Fluent Bit's config.

  • Create an exclusion filter in Papertrail.

See the Fluent Bit documentation for installation, inputs, filters, and buffering configuration.

Multi-container and multi-service apps

With a single [OUTPUT], the service.name in the header is applied to every container the collector handles, so the Program column shows one value for the whole host. System is still correct because of the shared host, but Program will not distinguish your services. To attribute Program per service, choose one of the following:

  • Use Option A (logspout): This is the simplest route. Syslog carries each container's name as the appname, so Program is filled per container with no extra config. This is the recommended path for multi-service apps that only need stdout/stderr.

  • One output per service (HTTP): Tag each service's logs at the input, then give each its own [OUTPUT] with its own header. Because each output's batch contains a single service, the per-batch header is correct.

stdout/stderr

Instead of Docker writing JSON log files that Fluent Bit tails, configure each service to send its logs directly to Fluent Bit. This requires changes to two files.

Modify fluent-bit.conf:

[INPUT]
    Name   forward
    Listen 0.0.0.0
    Port   24224

[OUTPUT]
    Name   http
    Match  service1
    ...
    Header X-Otel-Resource-Attr host.name=<YOUR_HOST>,service.name=<YOUR_SERVICE_1>

[OUTPUT]
    Name   http
    Match  service2
    ...
    Header X-Otel-Resource-Attr host.name=<YOUR_HOST>,service.name=<YOUR_SERVICE_2>

Add a logging section to docker-compose.yml:

services:
  service1:
    logging:
      driver: fluentd
      options:
        fluentd-address: localhost:24224
        tag: service1
        fluentd-async: "true"

  service2:
    logging:
      driver: fluentd
      options:
        fluentd-address: localhost:24224
        tag: service2
        fluentd-async: "true"

  fluent-bit:
    image: fluent/fluent-bit:latest
    ports:
      - "24224:24224"
    volumes:
      - ./fluent-bit.conf:/fluent-bit/etc/fluent-bit.conf
      - ./state:/fluent-bit/state
    restart: unless-stopped

Log files

Separate Docker volumes (service1-logs and service2-logs) are used in the example below.

[INPUT]
    Name        tail
    Path        /logs/service1/*.log
    Tag         service1
    DB          /fluent-bit/state/service1.db

[INPUT]
    Name        tail
    Path        /logs/service2/*.log
    Tag         service2
    DB          /fluent-bit/state/service2.db
services:
  service1:
    volumes:
      - service1-logs:/logs

  service2:
    volumes:
      - service2-logs:/logs

  fluent-bit:
    image: fluent/fluent-bit:latest
    volumes:
      - ./fluent-bit.conf:/fluent-bit/etc/fluent-bit.conf
      - ./state:/fluent-bit/state
      - service1-logs:/logs/service1:ro
      - service2-logs:/logs/service2:ro
    restart: unless-stopped

volumes:
  service1-logs:
  service2-logs:

All services must be configured to log to the /logs directory.

Multiline parsing

If your application can output JSON (such as using Logback), each log event is emitted as a single JSON object and sent to Papertrail as a single record.

For applications with plain logging, it is necessary to specify a multiline parser depending on the language (multiline.parser) and the presence of Docker parser (the log text itself sits in a field named log):

[FILTER]
    Name              		multiline
    Match                 	*
    multiline.key_content	log
    multiline.parser      	java

For Kubernetes clusters, see Forward Kubernetes logs (Papertrail). A DaemonSet multiplexes many pods, so it must use the syslog output for correct per-pod attribution.

Fallback: Forward via a syslog daemon

If neither logspout nor Fluent Bit can reach the Papertrail collector directly, configure rsyslog on the Docker host to tail the container log files from /var/lib/docker/containers/ and forward them to Papertrail over TLS. The rsyslog template injects the ingestion token as RFC 5424 structured data. See Send logs using syslog (Papertrail) for rsyslog and NXlog configuration.

The scripts are not supported under any SolarWinds support program or service. The scripts are provided AS IS without warranty of any kind. SolarWinds further disclaims all warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The risk arising out of the use or performance of the scripts and documentation stays with you. In no event shall SolarWinds or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the scripts or documentation.