Skip to content

Instantly share code, notes, and snippets.

@cgswong
Last active August 29, 2015 14:16
Show Gist options
  • Save cgswong/4c2751b174e59fdcd0af to your computer and use it in GitHub Desktop.
Save cgswong/4c2751b174e59fdcd0af to your computer and use it in GitHub Desktop.
Log forwarder systemd unit for any OS with journal logs (CoreOS)
[Unit]
Description=Journal redirect to remote
[Service]
Restart=on-failure
StartLimitInterval=60s
StartLimitBurst=3
TimeoutStartSec=0
ExecStart=/bin/sh -c '/usr/bin/journalctl -f -o short | /usr/bin/ncat [hostname/IP] [port]'
PIDFile=/var/run/journalncat.pid
ExecStop=/bin/kill -TERM `cat /var/run/journalncat.pid`
[Install]
WantedBy=multi-user.target
[X-Fleet]
Global=true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment