remote_syslog2
remote_syslog2 copied to clipboard
remote_syslog2 on Ubuntu arm64 (like AWS Graviton)
remote_syslog2 on Ubuntu 20.04 arm64
This was tested with AWS Graviton 2.
Add System (on Papertrail dashboard)
- https://papertrailapp.com/systems/setup?type=system&platform=unix
wget -qO - --header="X-Papertrail-Token: SOME_TOKEN" \
https://papertrailapp.com/destinations/SOME_ID/setup.sh | sudo bash
Download and unpack
cd /tmp
wget https://github.com/papertrail/remote_syslog2/archive/refs/tags/v0.20.tar.gz
tar -xzvf v0.20.tar.gz
cd remote_syslog2-0.20/
Build using go language
sudo apt install -y golang
go mod init
GO111MODULE=on go get ./...
go build
Make system wide available
sudo mv remote_syslog2 /usr/local/bin/remote_syslog
Create init
cd /tmp
wget https://raw.githubusercontent.com/papertrail/remote_syslog2/master/packaging/linux/remote_syslog.initd
sudo mv remote_syslog.initd /etc/init.d/remote_syslog
sudo chmod +x /etc/init.d/remote_syslog
Create remote_syslog service
sudo nano /etc/systemd/system/remote_syslog.service
[Unit]
Documentation=man:systemd-sysv-generator(8)
SourcePath=/etc/init.d/remote_syslog
Description=LSB: Start and Stop
Before=multi-user.target
Before=multi-user.target
Before=multi-user.target
Before=graphical.target
After=network-online.target
After=remote-fs.target
Wants=network-online.target
[Service]
Type=forking
Restart=no
TimeoutSec=5min
IgnoreSIGPIPE=no
KillMode=process
GuessMainPID=no
RemainAfterExit=yes
SuccessExitStatus=5 6
ExecStart=/etc/init.d/remote_syslog start
ExecStop=/etc/init.d/remote_syslog stop
ExecReload=/etc/init.d/remote_syslog reload
[Install]
WantedBy=multi-user.target
Create basic config (example for PM2 + Nginx)
nano /etc/log_files.yml
files:
- /var/log/nginx/access.log
- /var/log/nginx/error.log
- /home/forge/.pm2/logs/*
- /home/root/.pm2/logs/*
destination:
host: logs2.papertrailapp.com
port: REPLACE_WITH_YOUR_PAPERTRAIL_PORT
protocol: tls
Start the service and enable it on startup
sudo service remote_syslog start
sudo systemctl enable remote_syslog