Configuring centralized logging from systemd

To send system logs from Linux distributions using systemd (including newer releases of CentOS and CoreOS), follow the steps shown below to forward output from journalctl to Papertrail.

For applications running in a Docker container, choose from one of the options described under the Docker configuration page.

Forwarding system logs

Create a new unit/service that pipes output from journalctl into ncat or socat by following the steps below:

[Unit]
Description=Papertrail
After=systemd-journald.service
Requires=systemd-journald.service

[Service]
ExecStart=/bin/sh -c "journalctl -f | ncat --ssl <host>.papertrailapp.com <port>"
TimeoutStartSec=0
Restart=on-failure
RestartSec=5s

[Install]
WantedBy=multi-user.target

If ncat is not available, use socat instead by:

ExecStart=/bin/sh -c "journalctl -f | socat - SSL:<host>.papertrailapp.com:<port>,cafile=/etc/papertrail-bundle.pem"