Modular syslog-ng configuration, with one log file per daemon or service.
The log files are stored below /var/log/syslog/<daemon>.log
Log messages which aren't associated with a specific service or daemon will be logged to the catch-all /var/log/messages
log file.
For example, syslog-ng will create log files as seen below:
ls /var/log/syslog
acpid.log dhcpcd.log lightdm.log polkitd.log sshd.log
bluetoothd.log dhcpd.log NetworkManager.log portage.log syslog-ng.log
dbus.log kernel.log ntpd.log postfix.log
Simply clone the Git repository and let /etc/syslog-ng
point to the root of your cloned repository:
<<<<<<< HEAD
git clone https://github.com/foss-cloud/syslog-ng.git ~/repos/syslog-ng
=======
git clone https://github.com/foss-cloud/syslog-ng.git ~/repos/syslog-ng
>>>>>>> dcd0b5ab39fdf0bdb601cb53360ebe6f176d50fd
mv /etc/syslog-ng /etc/syslog-ng.orig
ln -s ~/repos/syslog-ng /etc/syslog-ng
/etc/init.d/syslog-ng restart
If you're looking for a more enterprisish way to install the configuration, check out the puppet-syslogng module, which is based on this configuration. Alternatively, you can also find an ebuild for installing the configuration.
Contributions are very welcome, simply fork our repository and send us a pull-request. If you found a bug, open an issue.
There are so many daemons out there, that we can't add all by ourself :) If you're using a software for which no configuration exists (your log messages are appended to /var/log/messages
), proceed with the following basic steps to create and submit a new configuration:
- Fork our repository on GitHub
- Create the required configuration files:
serviceName=<NAME-OF-THE-SOFTWARE> # For example OpenSSH, or Bluetooth daemon.
serviceProgramName=<NAME-OF-THE-SYSLOG-TAG> # For example sshd, or bluetoothd.
# Create the syslog-ng filter
cat << EOF > "syslog-ng.conf.d/filter.d/${serviceProgramName}.conf"
# ${serviceName} (${serviceProgramName}) filter
filter f_${serviceProgramName} { program("^${serviceProgramName}\$"); };
EOF
# Create the syslog-ng file destination
cat << EOF > "syslog-ng.conf.d/destination.d/${serviceProgramName}.conf"
# ${serviceName} (${serviceProgramName}) destination
destination d_${serviceProgramName} { file("\`syslog_dir\`/${serviceProgramName}.log"); };
EOF
# Create the syslog-ng default file log path
cat << EOF > "syslog-ng.conf.d/log.d/90_${serviceProgramName}.conf"
# ${serviceName} (${serviceProgramName}) final file log
log { source(s_log); filter(f_${serviceProgramName}); destination(d_${serviceProgramName}); flags(final); };
EOF
/etc/init.d/syslog-ng reload
- Test your new config snippets, by generating a log message from your new software and see if
/var/log/syslog/<serviceProgramName>.log
gets created. - Commit and push your additions
git add syslog-ng.conf.d/filter.d/${serviceProgramName}.conf \
syslog-ng.conf.d/destination.d/${serviceProgramName}.conf \
syslog-ng.conf.d/log.d/90_${serviceProgramName}.conf
git commit -m "Adding configuration for ${serviceName} (${serviceProgramName})."
git push
- Send us a pull-request.
- Thank you! :)