1 AUTHOR: Jim Gifford <lfs-hints at jg555.com>
5 LICENSE: GNU Free Documentation License Version 1.2
7 SYNOPSIS: Setup syslog-ng for LFS
9 DESCRIPTION: This will describe on how to replace syslog
10 and klog with syslog-ng.
16 Introduction to syslog-ng
18 Download location for syslog-ng
19 http://www.balabit.com/downloads/syslog-ng/1.6/src
20 syslog-ng Version used 1.6.4
22 Download location for libol
23 http://www.balabit.com/downloads/libol/0.3
24 libol library used 0.3.13
26 syslog-ng is a a syslogd replacement, but with new functionality. The
27 original syslogd allows messages only to be sorted based on prioiry/facility
28 pairs. Syslog-ng adds the posibility to filter based on message contents using
29 regular expressions. The new configuration shceme is intuitive and powerful.
30 Forwarding logs over TCP and remembering all forwarding hops makes it ideal
31 for firewall environments.
34 Installation of syslog-ng
36 Install syslog-ng's libol by running the following commands:
38 ./configure --prefix=/usr --enable-shared &&
43 Install syslog-ng by running the following commmands|
45 ./configure --prefix=/usr --sysconfdir=/etc &&
54 /etc/syslog-ng/syslog-ng.conf
56 Create the syslog-ng.conf file by running:
58 mkdir -p /etc/syslog-ng
59 cat > /etc/syslog-ng/syslog-ng.conf << "EOF"
60 # Begin /etc/syslog-ng/syslog-ng.conf
63 # Syslog-ng configuration for Linux from Scratch
76 source src { unix-stream("/dev/log");
81 destination authlog { file("/var/log/authorize.log"); };
82 destination syslog { file("/var/log/syslog.log"); };
83 destination cron { file("/var/log/cron.log"); };
84 destination daemon { file("/var/log/daemon.log"); };
85 destination kernel { file("/var/log/kernel.log"); };
86 destination lpr { file("/var/log/lpr.log"); };
87 destination user { file("/var/log/user.log"); };
88 destination uucp { file("/var/log/uucp.log"); };
89 destination mail { file("/var/log/mail.log"); };
90 destination news { file("/var/log/news.log"); };
91 destination debug { file("/var/log/debug.log"); };
92 destination messages { file("/var/log/messages.log"); };
93 destination everything { file("/var/log/everything.log"); };
94 destination console { usertty("root"); };
95 destination console_all { file("/dev/tty12"); };
97 filter f_auth { facility(auth); };
98 filter f_authpriv { facility(auth, authpriv); };
99 filter f_syslog { not facility(authpriv, mail); };
100 filter f_cron { facility(cron); };
101 filter f_daemon { facility(daemon); };
102 filter f_kernel { facility(kern); };
103 filter f_lpr { facility(lpr); };
104 filter f_mail { facility(mail); };
105 filter f_news { facility(news); };
106 filter f_user { facility(user); };
107 filter f_uucp { facility(cron); };
108 filter f_news { facility(news); };
109 filter f_debug { not facility(auth, authpriv, news, mail); };
110 filter f_messages { level(info..warn) and not facility(auth, authpriv, mail, news); };
111 filter f_everything { level(debug..emerg) and not facility(auth, authpriv); };
113 filter f_emergency { level(emerg); };
114 filter f_info { level(info); };
115 filter f_notice { level(notice); };
116 filter f_warn { level(warn); };
117 filter f_crit { level(crit); };
118 filter f_err { level(err); };
120 log { source(src); filter(f_authpriv); destination(authlog); };
121 log { source(src); filter(f_syslog); destination(syslog); };
122 log { source(src); filter(f_cron); destination(cron); };
123 log { source(src); filter(f_daemon); destination(daemon); };
124 log { source(src); filter(f_kernel); destination(kernel); };
125 log { source(src); filter(f_lpr); destination(lpr); };
126 log { source(src); filter(f_mail); destination(mail); };
127 log { source(src); filter(f_news); destination(news); };
128 log { source(src); filter(f_user); destination(user); };
129 log { source(src); filter(f_uucp); destination(uucp); };
130 log { source(src); filter(f_debug); destination(debug); };
131 log { source(src); filter(f_messages); destination(messages); };
132 log { source(src); filter(f_emergency); destination(console); };
133 log { source(src); filter(f_everything); destination(everything); };
134 log { source(src); destination(console_all); };
136 # END /etc/syslog-ng/syslog-ng.conf
140 Configuration information
142 Please note that this only is a sample configuration and you
143 will MOST CERTAINLY have to edit this to suite your needs. This
144 should work with most configuration. For more configuration
145 information check man syslog-ng or go to the syslog-ng web site at
146 http://www.balabit.com/products/syslog_ng/reference/book1.html for
147 the basic docuemenation
150 Make syslog-ng start on bootup
152 Create the /etc/rc.d/init.d/syslog-ng by running:
154 cat > /etc/rc.d/init.d/syslog-ng << "EOF"
156 # Begin $rc_base/init.d/syslog-ng - Syslog-ng loader
158 # Based on sysklogd script from LFS-3.1 and earlier.
159 # Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org
161 source /etc/sysconfig/rc
166 echo "Starting System Log..."
170 echo "Stopping System Log..."
185 echo "Usage: $0 {start|stop|restart|status}"
190 # End $rc_base/init.d/syslog-ng
194 Make the script executable and create the appropriate symlinks by
197 chmod 755 /etc/rc.d/init.d/syslog-ng &&
198 ln -s /etc/rc.d/init.d/syslog-ng /etc/rc.d/rc0.d/K40syslog-ng &&
199 ln -s /etc/rc.d/init.d/syslog-ng /etc/rc.d/rc1.d/K80syslog-ng &&
200 ln -s /etc/rc.d/init.d/syslog-ng /etc/rc.d/rc2.d/S10syslog-ng &&
201 ln -s /etc/rc.d/init.d/syslog-ng /etc/rc.d/rc3.d/S10syslog-ng &&
202 ln -s /etc/rc.d/init.d/syslog-ng /etc/rc.d/rc4.d/S10syslog-ng &&
203 ln -s /etc/rc.d/init.d/syslog-ng /etc/rc.d/rc5.d/S10syslog-ng &&
204 ln -s /etc/rc.d/init.d/syslog-ng /etc/rc.d/rc6.d/K40syslog-ng
209 You will need to prevent sysklogd from starting
211 rm /etc/rc.d/rc0.d/K40sysklogd &&
212 rm /etc/rc.d/rc1.d/K80sysklogd &&
213 rm /etc/rc.d/rc2.d/S10sysklogd &&
214 rm /etc/rc.d/rc3.d/S10sysklogd &&
215 rm /etc/rc.d/rc4.d/S10sysklogd &&
216 rm /etc/rc.d/rc5.d/S10sysklogd &&
217 rm /etc/rc.d/rc6.d/K40sysklogd
221 Extra: Logging of Iptables Information
223 Add the following information to log all iptables information
224 into it's own file called /var/log/iptables.log
226 destination iptables { file("/var/log/iptables.log"); };
227 filter f_iptables { match("IN="); };
228 log { source(src); filter(f_iptables); destination(iptables); };
233 CHANGELOG: 1.9 Updated to New Version
234 1.8 Fixed Typo reported by Joern Wittek
235 1.7 Updated to New Versions and Links
236 1.6 Fixes from DJ Lucas
237 1.5 Updated CVS Location
239 1.3 Update to New Hint Format Completed
241 1.1 Updated download locations
244 New Version of this document can be viewed from http://cvs.jg555.com/viewcvs.cgi/lfs-hints