Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remote_syslog2 on Ubuntu arm64 (like AWS Graviton) #237

Open
jpbarbosa opened this issue Oct 27, 2021 · 0 comments
Open

remote_syslog2 on Ubuntu arm64 (like AWS Graviton) #237

jpbarbosa opened this issue Oct 27, 2021 · 0 comments

Comments

@jpbarbosa
Copy link

jpbarbosa commented Oct 27, 2021

remote_syslog2 on Ubuntu 20.04 arm64

This was tested with AWS Graviton 2.

Add System (on Papertrail dashboard)

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant