Logicalwebhost Cheatsheet

Linux & Open Source Cheatsheets & Howto's

Skip to: Content | Sidebar | Footer

syslog-ng howto

Centralized logging will help a ton if you have a network issue. If something happens, you’ll just be able to look one place instead of a bunch. There are several ways to do this, but syslog-ng seems to offer some decent features, and it’s available in standard repositories.

apt-get install syslog-ng
mkdir /var/log/remotelogs/
uncomment next line and add options:
source s_net { tcp(ip( port(1000) max-connections (5000)); udp(); };
  destination d_auth { file("/var/log/remotelogs/$HOST/auth.log"); };
destination d_cron { file("/var/log/remotelogs/$HOST/cron.log"); };
destination d_daemon { file("/var/log/remotelogs/$HOST/daemon.log"); };
destination d_kern { file("/var/log/remotelogs/$HOST/kern.log"); };
destination d_lpr { file("/var/log/remotelogs/$HOST/lpr.log"); };
destination d_mail { file("/var/log/remotelogs/$HOST/mail.log"); };
destination d_syslog { file("/var/log/remotelogs/$HOST/syslog"); };
destination d_user { file("/var/log/remotelogs/$HOST/user.log"); };
destination d_uucp { file("/var/log/remotelogs/$HOST/uucp.log"); };
# This files are the log come from the mail subsystem.
destination d_mailinfo { file("/var/log/remotelogs/$HOST/mail.info"); };
destination d_mailwarn { file("/var/log/remotelogs/$HOST/mail.warn"); };
destination d_mailerr { file("/var/log/remotelogs/$HOST/mail.err"); };
vi /etc/logrotate.d/syslog-ng
systemctl disable syslog.service
systemctl enable syslog-ng.service
/etc/init.d/syslog-ng restart

Now look in /var/log/remotelogs and see if there’s a folder in there with your hostname, and some log files in it like syslog. You should have some entries in syslog because you just restarted syslog-ng