rsyslog collects system and application syslog messages. On a VPS it is the base layer before alerts or a SIEM.
Steps
Install and start rsyslog:
sudo apt updatesudo apt install -y rsyslogsudo systemctl enable --now rsyslogsystemctl status rsyslog --no-pagerAdd a simple rule to a dedicated file:
echo 'local0.* /var/log/xernode-local0.log' | sudo tee /etc/rsyslog.d/30-xernode.confsudo systemctl restart rsyslogEmit a test message and read it:
logger -p local0.info "xernode rsyslog ok"sudo tail -n 5 /var/log/xernode-local0.logCheck the service journal if something fails:
sudo journalctl -u rsyslog -n 50 --no-pager
Tips
- Rotate the new file with logrotate so it cannot fill the disk.
- For remote intake, open TCP/UDP 514 only behind a tight firewall ACL.
ext step
Clean logs on a VPS with headroom: Deploy your Cloud VPS.