1 TITLE: Setting up syslog-ng
3 AUTHOR: Jim Gifford <giffordj@linkline.com>
6 How to setup syslog-ng, a replacement for sysklogd.
11 Introduction to syslog-ng
13 Download location http://www.balabit.hu/en/downloads/syslog-ng
15 libol library used 0.3.3
17 syslog-ng is a a syslogd replacement, but with new functionality. The
18 original syslogd allows messages only to be sorted based on prioiry/facility
19 pairs. Syslog-ng adds the posibility to filter based on message contents using
20 regular expressions. The new configuration shceme is intuitive and powerful.
21 Forwarding logs over TCP and remembering all forwarding hops makes it ideal
22 for firewall environments.
25 Installation of syslog-ng
27 Install syslog-ng's libol by running the following commands:
29 ./configure --prefix=/usr --enable-shared &&
34 Install syslog-ng by running the following commmands|
36 ./configure --prefix=/usr --sysconfigdir=/etc &&
45 /etc/syslog-ng/syslog-ng.conf
47 Create the syslog-ng.conf file by running:
49 cat > /etc/syslog-ng/syslog-ng.conf << "EOF"
50 # Begin /etc/syslog-ng/syslog-ng.conf
53 # Syslog-ng configuration for Linux from Scratch
66 source src { unix-stream("/dev/log");
71 destination authlog { file("/var/log/authorize.log"); };
72 destination syslog { file("/var/log/syslog.log"); };
73 destination cron { file("/var/log/cron.log"); };
74 destination daemon { file("/var/log/daemon.log"); };
75 destination kernel { file("/var/log/kernel.log"); };
76 destination lpr { file("/var/log/lpr.log"); };
77 destination user { file("/var/log/user.log"); };
78 destination uucp { file("/var/log/uucp.log"); };
79 destination mail { file("/var/log/mail.log"); };
80 destination news { file("/var/log/news.log"); };
81 destination debug { file("/var/log/debug.log"); };
82 destination messages { file("/var/log/messages.log"); };
83 destination everything { file("/var/log/everything.log"); };
84 destination console { usertty("root"); };
85 destination console_all { file("/dev/tty12"); };
87 filter f_auth { facility(auth); };
88 filter f_authpriv { facility(auth, authpriv); };
89 filter f_syslog { not facility(authpriv, mail); };
90 filter f_cron { facility(cron); };
91 filter f_daemon { facility(daemon); };
92 filter f_kernel { facility(kern); };
93 filter f_lpr { facility(lpr); };
94 filter f_mail { facility(mail); };
95 filter f_news { facility(news); };
96 filter f_user { facility(user); };
97 filter f_uucp { facility(cron); };
98 filter f_news { facility(news); };
99 filter f_debug { not facility(auth, authpriv, news, mail); };
100 filter f_messages { level(info..warn) and not facility(auth, authpriv, mail, news); };
101 filter f_everything { level(debug..emerg) and not facility(auth, authpriv); };
103 filter f_emergency { level(emerg); };
104 filter f_info { level(info); };
105 filter f_notice { level(notice); };
106 filter f_warn { level(warn); };
107 filter f_crit { level(crit); };
108 filter f_err { level(err); };
110 log { source(src); filter(f_authpriv); destination(authlog); };
111 log { source(src); filter(f_syslog); destination(syslog); };
112 log { source(src); filter(f_cron); destination(fcron); };
113 log { source(src); filter(f_daemon); destination(daemon); };
114 log { source(src); filter(f_kernel); destination(kernel); };
115 log { source(src); filter(f_lpr); destination(lpr); };
116 log { source(src); filter(f_mail); destination(mail); };
117 log { source(src); filter(f_news); destination(news); };
118 log { source(src); filter(f_user); destination(user); };
119 log { source(src); filter(f_uucp); destination(uucp); };
120 log { source(src); filter(f_debug); destination(debug); };
121 log { source(src); filter(f_messages); destination(messages); };
122 log { source(src); filter(f_emergency); destination(console); };
123 log { source(src); filter(f_everything); destination(everything); };
124 log { source(src); destination(console_all); };
126 # END /etc/syslog-ng/syslog-ng.conf
129 Configuration information
131 Please note that this only is a sample configuration and you
132 will MOST CERTAINLY have to edit this to suite your needs. This
133 should work with most configuration. For more configuration
134 information check man syslog-ng or go to the syslog-ng web site at
135 http://www.balabit.hu/static/syslog-ng/reference/book1.html for
136 the basic docuemenation
139 Make syslog-ng start on bootup
141 Create the /etc/rc.d/init.d/syslog-ng by running:
143 cat > /etc/rc.d/init.d/syslog-ng << "EOF"
145 # Begin $rc_base/init.d/syslog-ng - Syslog-ng loader
147 # Based on sysklogd script from LFS-3.1 and earlier.
148 # Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org
150 source /etc/sysconfig/rc
155 echo "Starting System Log..."
159 echo "Stopping System Log..."
174 echo "Usage: $0 {start|stop|restart|status}"
179 # End $rc_base/init.d/syslog-ng
183 Make the script executable and create the appropriate symlinks by
186 chmod 755 /etc/rc.d/init.d/syslog-ng &&
187 ln -s /etc/rc.d/init.d/syslog-ng /etc/rc.d/rc0.d/K40syslog-ng &&
188 ln -s /etc/rc.d/init.d/syslog-ng /etc/rc.d/rc1.d/K80syslog-ng &&
189 ln -s /etc/rc.d/init.d/syslog-ng /etc/rc.d/rc2.d/S10syslog-ng &&
190 ln -s /etc/rc.d/init.d/syslog-ng /etc/rc.d/rc3.d/S10syslog-ng &&
191 ln -s /etc/rc.d/init.d/syslog-ng /etc/rc.d/rc4.d/S10syslog-ng &&
192 ln -s /etc/rc.d/init.d/syslog-ng /etc/rc.d/rc5.d/S10syslog-ng &&
193 ln -s /etc/rc.d/init.d/syslog-ng /etc/rc.d/rc6.d/K40syslog-ng
198 You will need to prevent sysklogd from starting
200 rm /etc/rc.d/rc0.d/K40sysklogd &&
201 rm /etc/rc.d/rc1.d/K80sysklogd &&
202 rm /etc/rc.d/rc2.d/S10sysklogd &&
203 rm /etc/rc.d/rc3.d/S10sysklogd &&
204 rm /etc/rc.d/rc4.d/S10sysklogd &&
205 rm /etc/rc.d/rc5.d/S10sysklogd &&
206 rm /etc/rc.d/rc6.d/K40sysklogd
210 Extra: Logging of Iptables Information
212 Add the following information to log all iptables information
213 into it's own file called /var/log/iptables.log
215 destination iptables { file("/var/log/iptables.log"); };
216 filter f_iptables { match("IN="); };
217 log { source(src); filter(f_iptables); destination(iptables); };
220 Mail suggestions to giffordj@linkline.com
222 New Version of this document can be viewed from
223 http://www.jg555.com/cvs