Last modified: Oct. 20, 2008
Contents
1 - Summary
2 - Syslog-ng installation
3 - Service configuration
4 - Service check
1 - Summary
This guide will show you how to install syslog-ng in FreeBSD. This has been
tested in FreeBSD 7.0.
2 - Syslog-ng installation
Install the syslog-ng package from an FreeBSD FTP mirror server.
# sudo setenv PACKAGESITE ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-7.0-release/All/
# sudo pkg_add -r syslog-ng-2.0.3
3 - Service configuration
Find where the syslog-ng daemon was installed to.
# pkg_info -L syslog-ng-2.0.3 | grep sbin
/usr/local/sbin/syslog-ng
Rename the startup configuration file so the syslog-ng service will start
first.
# sudo mv /usr/local/etc/rc.d/syslog-ng /usr/local/etc/rc.d/001-syslog-ng
Edit /etc/rc.conf.local so that syslog-ng will start when the system starts
up and not syslog. Add the following.
syslogd_enable="NO"
syslog_ng_enable="YES"
syslog_ng_pid="/var/run/syslog-ng.pid"
# sudo vi /etc/rc.conf.local
Find where the configuration file should be put.
# strings /usr/local/sbin/syslog-ng | grep syslog-ng.conf
-f , --cfgfile= Set config file name, default=/usr/local/etc/syslog-ng.conf
/usr/local/etc/syslog-ng.conf
You can now create your own syslog-ng.conf file if you like. You can use the
following for your source.
source local { internal(); file("/dev/klog" log_prefix("kernel: ")); unix-dgram("/var/run/log"); };
# pkg_info -L syslog-ng-2.0.3 | grep syslog-ng.conf
/usr/local/man/man5/syslog-ng.conf.5.gz
/usr/local/etc/syslog-ng/syslog-ng.conf.sample
# sudo cp /usr/local/etc/syslog-ng/syslog-ng.conf.sample /usr/local/etc/syslog-ng.conf
# sudo cp /usr/local/etc/syslog-ng.conf /usr/local/etc/syslog-ng.conf.example
# sudo chmod u+w /usr/local/etc/syslog-ng.conf
# sudo vi /usr/local/etc/syslog-ng.conf
# sudo /usr/local/sbin/syslog-ng -s -f /usr/local/etc/syslog-ng.conf
Stop the syslog service and start the syslog-ng service.
# sudo kill -9 `cat /var/run/syslog.pid`
# sudo rm -fP /var/run/syslog.pid
# sudo rm -fP /var/run/syslogd.sockets
# sudo ps aux | grep syslog
# sudo /usr/local/etc/rc.d/001-syslog-ng start
Starting syslog_ng.
# sudo cat /var/run/syslog-ng.pid
1359
4 - Service check
Reboot your computer. Log in like normal and check to see that the syslog
service isn't running and the syslog-ng service is running. That's it, now you
have syslog-ng 2 running in FreeBSD.
# sudo shutdown -r now
# sudo ls -1 /var/run/syslog*
/var/run/syslog-ng.pid
# sudo cat /var/run/syslog-ng.pid
505
|