Typo
[linux_from_scratch_hints.git] / OLD / syslog-ng.txt
blob6b3d28338f962bc7830a5e327cc83c24332e4ce0
1 TITLE:          Setting up syslog-ng
2 LFS VERSION:    any
3 AUTHOR:         Jim Gifford <giffordj@linkline.com>
5 SYNOPSIS:
6         How to setup syslog-ng, a replacement for sysklogd.
8 HINT:
9 $Revision: 1.1 $
11 Introduction to syslog-ng
13 Download location               http://www.balabit.hu/en/downloads/syslog-ng
14 Version used                    1.5.21
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.
24 ---
25 Installation of syslog-ng
27 Install syslog-ng's libol by running the following commands:
29 ./configure --prefix=/usr --enable-shared &&
30 make &&
31 make install
33 ---
34 Install syslog-ng by running the following commmands|
36 ./configure --prefix=/usr --sysconfigdir=/etc &&
37 make &&
38 make install
40 ----
41 Configuring syslog-ng
43 Config files
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
56 options {       sync (0);
57                 time_reopen (10);
58                 log_fifo_size (1000);
59                 long_hostnames(off); 
60                 use_dns (no);
61                 use_fqdn (no);
62                 create_dirs (no);
63                 keep_hostname (yes);
64         };
66 source src {    unix-stream("/dev/log");
67                 internal();
68                 pipe("/proc/kmsg");
69             };
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"
144 #!/bin/sh
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
151 source $rc_functions
153 case "$1" in
154         start)
155                 echo "Starting System Log..."
156                 loadproc syslog-ng
157                 ;;
158         stop)
159                 echo "Stopping System Log..."
160                 killproc syslog-ng
161                 ;;
163         restart)
164                 $0 stop
165                 sleep 1
166                 $0 start
167                 ;;
169         status)
170                 statusproc syslog-ng
171                 ;;
173         *)
174                 echo "Usage: $0 {start|stop|restart|status}"
175                 exit 1
176                 ;;
177 esac
179 # End $rc_base/init.d/syslog-ng
183 Make the script executable and create the appropriate symlinks by
184 running:
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
196 Last step
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