Skip to content

LawHsing/fc-syslog-ng-configuration

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

76 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview

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

Installation

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.

Contribution

Contributions are very welcome, simply fork our repository and send us a pull-request. If you found a bug, open an issue.

Missing daemon or service configuration

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:

  1. Fork our repository on GitHub
  2. 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
  1. Test your new config snippets, by generating a log message from your new software and see if /var/log/syslog/<serviceProgramName>.log gets created.
  2. 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
  1. Send us a pull-request.
  2. Thank you! :)

About

Init commit

Resources

Stars

Watchers

Forks

Packages

No packages published