]> git.donarmstrong.com Git - dsa-puppet.git/blob - templates/syslog-ng.conf.erb
prepare remote sysloging, server side patches
[dsa-puppet.git] / templates / syslog-ng.conf.erb
1 <% if syslogversion == "3" -%>
2 @version: 3.0
3 <%end%>
4 ##
5 ## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE.
6 ## USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git
7 ##
8
9 #
10 # Configuration file for syslog-ng under Debian
11 #
12 # attempts at reproducing default syslog behavior
13
14 # the standard syslog levels are (in descending order of priority):
15 # emerg alert crit err warning notice info debug
16 # the aliases "error", "panic", and "warn" are deprecated
17 # the "none" priority found in the original syslogd configuration is
18 # only used in internal messages created by syslogd
19
20
21 ######
22 # options
23
24 options {
25         # disable the chained hostname format in logs
26         # (default is enabled)
27         chain_hostnames(0);
28
29         # the time to wait before a died connection is re-established
30         # (default is 60)
31         time_reopen(10);
32
33         # the time to wait before an idle destination file is closed
34         # (default is 60)
35         time_reap(360);
36
37         # the number of lines buffered before written to file
38         # you might want to increase this if your disk isn't catching with
39         # all the log messages you get or if you want less disk activity
40         # (say on a laptop)
41         # (default is 0)
42         #sync(0);
43
44         # the number of lines fitting in the output queue
45         log_fifo_size(2048);
46
47         # enable or disable directory creation for destination files
48         create_dirs(yes);
49
50         # default owner, group, and permissions for log files
51         # (defaults are 0, 0, 0600)
52         #owner(root);
53         group(adm);
54         perm(0640);
55
56         # default owner, group, and permissions for created directories
57         # (defaults are 0, 0, 0700)
58         #dir_owner(root);
59         #dir_group(root);
60         dir_perm(0755);
61
62         # enable or disable DNS usage
63         # syslog-ng blocks on DNS queries, so enabling DNS may lead to
64         # a Denial of Service attack
65         # (default is yes)
66         use_dns(no);
67
68         # maximum length of message in bytes
69         # this is only limited by the program listening on the /dev/log Unix
70         # socket, glibc can handle arbitrary length log messages, but -- for
71         # example -- syslogd accepts only 1024 bytes
72         # (default is 2048)
73         #log_msg_size(2048);
74
75         #Disable statistic log messages.
76         stats_freq(0);
77
78         # Some program send log messages through a private implementation.
79         # and sometimes that implementation is bad. If this happen syslog-ng
80         # may recognise the program name as hostname. Whit this option
81         # we tell the syslog-ng that if a hostname match this regexp than that
82         # is not a real hostname.
83         bad_hostname("^gconfd$");
84 };
85
86
87 ######
88 # sources
89
90 # all known message sources
91 source s_all {
92         # message generated by Syslog-NG
93         internal();
94 <% if kernel == 'Linux' %>
95         # standard Linux log source (this is the default place for the syslog()
96         # function to send logs to)
97         unix-stream("/dev/log");
98         # messages from the kernel
99 <% if syslogversion == "2" -%>
100         file("/proc/kmsg" log_prefix("kernel: "));
101 <% else %>
102         file("/proc/kmsg" program_override("kernel: "));
103 <%end%>
104 <% else %>
105         # standard Linux log source (this is the default place for the syslog()
106         # function to send logs to)
107         unix-dgram("/var/run/log");
108         # messages from the kernel
109 <% if syslogversion == "2" -%>
110         file("/dev/klog" log_prefix("kernel: "));
111 <% else %>
112         file("/dev/klog" program_override("kernel: "));
113 <%end%>
114         # use the following line if you want to receive remote UDP logging messages
115         # (this is equivalent to the "-r" syslogd flag)
116 <% if hostname == "paganini" -%>
117         udp();
118 <%end%>
119 };
120
121 <% if hostname == "heininen" -%>
122 source s_network {
123         tcp6(port(5140)
124                 tls( key_file("/etc/exim4/ssl/thishost.key")
125                      cert_file("/etc/exim4/ssl/thishost.cert")
126                      ca_dir("/etc/exim4/ssl/")
127                 )
128         );
129 };
130 <%end%>
131
132
133 ######
134 # destinations
135
136 # some standard log files
137 destination df_auth { file("/var/log/auth.log"); };
138 destination df_syslog { file("/var/log/syslog"); };
139 destination df_cron { file("/var/log/cron.log"); };
140 destination df_daemon { file("/var/log/daemon.log"); };
141 destination df_kern { file("/var/log/kern.log"); };
142 destination df_lpr { file("/var/log/lpr.log"); };
143 destination df_mail { file("/var/log/mail.log" group(maillog)); };
144 destination df_mail_info { file("/var/log/mail.info" group(maillog)); };
145 destination df_mail_warn { file("/var/log/mail.warn" group(maillog)); };
146 destination df_mail_err { file("/var/log/mail.err" group(maillog)); };
147 destination df_user { file("/var/log/user.log" perm(0644)); };
148 destination df_uucp { file("/var/log/uucp.log"); };
149
150 # these files are meant for the mail system log files
151 # and provide re-usable destinations for {mail,cron,...}.info,
152 # {mail,cron,...}.notice, etc.
153 destination df_facility_dot_info { file("/var/log/$FACILITY.info"); };
154 destination df_facility_dot_notice { file("/var/log/$FACILITY.notice"); };
155 destination df_facility_dot_warn { file("/var/log/$FACILITY.warn"); };
156 destination df_facility_dot_err { file("/var/log/$FACILITY.err"); };
157 destination df_facility_dot_crit { file("/var/log/$FACILITY.crit"); };
158
159 # these files are meant for the news system, and are kept separated
160 # because they should be owned by "news" instead of "root"
161 destination df_news_dot_notice { file("/var/log/news/news.notice" owner("news")); };
162 destination df_news_dot_err { file("/var/log/news/news.err" owner("news")); };
163 destination df_news_dot_crit { file("/var/log/news/news.crit" owner("news")); };
164
165 # some more classical and useful files found in standard syslog configurations
166 destination df_debug { file("/var/log/debug"); };
167 destination df_messages { file("/var/log/messages"); };
168
169 <% if kernel == 'Linux' %>
170 # pipes
171 # a console to view log messages under X
172 destination dp_xconsole { pipe("/dev/xconsole"); };
173
174 <% end %>
175 # consoles
176 # this will send messages to everyone logged in
177 destination du_all { usertty("*"); };
178
179
180 ######
181 # filters
182
183 # all messages from the auth and authpriv facilities
184 filter f_auth { facility(auth, authpriv); };
185
186 # all messages except from the auth and authpriv facilities
187 filter f_syslog { not facility(auth, authpriv); };
188
189 # respectively: messages from the cron, daemon, kern, lpr, mail, news, user,
190 # and uucp facilities
191 filter f_cron { facility(cron); };
192 filter f_daemon { facility(daemon); };
193 filter f_kern { facility(kern); };
194 filter f_lpr { facility(lpr); };
195 filter f_mail { facility(mail); };
196 filter f_news { facility(news); };
197 filter f_user { facility(user); };
198 filter f_uucp { facility(uucp); };
199
200 # some filters to select messages of priority greater or equal to info, warn,
201 # and err
202 # (equivalents of syslogd's *.info, *.warn, and *.err)
203 filter f_at_least_info { level(info..emerg); };
204 filter f_at_least_notice { level(notice..emerg); };
205 filter f_at_least_warn { level(warn..emerg); };
206 filter f_at_least_err { level(err..emerg); };
207 filter f_at_least_crit { level(crit..emerg); };
208
209 # all messages of priority debug not coming from the auth, authpriv, news, and
210 # mail facilities
211 filter f_debug { level(debug) and not facility(auth, authpriv, news, mail); };
212
213 # all messages of info, notice, or warn priority not coming form the auth,
214 # authpriv, cron, daemon, mail, and news facilities
215 filter f_messages {
216         level(info,notice,warn)
217             and not facility(auth,authpriv,cron,daemon,mail,news);
218 };
219
220 # messages with priority emerg
221 filter f_emerg { level(emerg); };
222
223 <% if kernel == 'Linux' %>
224 # complex filter for messages usually sent to the xconsole
225 filter f_xconsole {
226     facility(daemon,mail)
227         or level(debug,info,notice,warn)
228         or (facility(news)
229                 and level(crit,err,notice));
230 };
231
232 <% end %>
233 ######
234 # logs
235 # order matters if you use "flags(final);" to mark the end of processing in a
236 # "log" statement
237
238 # these rules provide the same behavior as the commented original syslogd rules
239
240 # auth,authpriv.*                 /var/log/auth.log
241 log {
242         source(s_all);
243 <% if hostname == "heininen" -%>
244         source(s_network);
245 <% end %>
246         filter(f_auth);
247         destination(df_auth);
248 };
249
250 # *.*;auth,authpriv.none          -/var/log/syslog
251 log {
252         source(s_all);
253 <% if hostname == "heininen" -%>
254         source(s_network);
255 <% end %>
256         filter(f_syslog);
257         destination(df_syslog);
258 };
259
260 # this is commented out in the default syslog.conf
261 # cron.*                         /var/log/cron.log
262 #log {
263 #        source(s_all);
264 #        filter(f_cron);
265 #        destination(df_cron);
266 #};
267
268 # daemon.*                        -/var/log/daemon.log
269 log {
270         source(s_all);
271 <% if hostname == "heininen" -%>
272         source(s_network);
273 <% end %>
274         filter(f_daemon);
275         destination(df_daemon);
276 };
277
278 # kern.*                          -/var/log/kern.log
279 log {
280         source(s_all);
281 <% if hostname == "heininen" -%>
282         source(s_network);
283 <% end %>
284         filter(f_kern);
285         destination(df_kern);
286 };
287
288 # lpr.*                           -/var/log/lpr.log
289 log {
290         source(s_all);
291 <% if hostname == "heininen" -%>
292         source(s_network);
293 <% end %>
294         filter(f_lpr);
295         destination(df_lpr);
296 };
297
298 # mail.*                          -/var/log/mail.log
299 log {
300         source(s_all);
301 <% if hostname == "heininen" -%>
302         source(s_network);
303 <% end %>
304         filter(f_mail);
305         destination(df_mail);
306 };
307
308 # user.*                          -/var/log/user.log
309 log {
310         source(s_all);
311 <% if hostname == "heininen" -%>
312         source(s_network);
313 <% end %>
314         filter(f_user);
315         destination(df_user);
316 };
317
318 # uucp.*                          /var/log/uucp.log
319 log {
320         source(s_all);
321 <% if hostname == "heininen" -%>
322         source(s_network);
323 <% end %>
324         filter(f_uucp);
325         destination(df_uucp);
326 };
327
328 # mail.info                       -/var/log/mail.info
329 log {
330         source(s_all);
331 <% if hostname == "heininen" -%>
332         source(s_network);
333 <% end %>
334         filter(f_mail);
335         filter(f_at_least_info);
336         destination(df_mail_info);
337 };
338
339 # mail.warn                       -/var/log/mail.warn
340 log {
341         source(s_all);
342 <% if hostname == "heininen" -%>
343         source(s_network);
344 <% end %>
345         filter(f_mail);
346         filter(f_at_least_warn);
347         destination(df_mail_warn);
348 };
349
350 # mail.err                        /var/log/mail.err
351 log {
352         source(s_all);
353 <% if hostname == "heininen" -%>
354         source(s_network);
355 <% end %>
356         filter(f_mail);
357         filter(f_at_least_err);
358         destination(df_mail_err);
359 };
360
361 # news.crit                       /var/log/news/news.crit
362 log {
363         source(s_all);
364 <% if hostname == "heininen" -%>
365         source(s_network);
366 <% end %>
367         filter(f_news);
368         filter(f_at_least_crit);
369         destination(df_news_dot_crit);
370 };
371
372 # news.err                        /var/log/news/news.err
373 log {
374         source(s_all);
375 <% if hostname == "heininen" -%>
376         source(s_network);
377 <% end %>
378         filter(f_news);
379         filter(f_at_least_err);
380         destination(df_news_dot_err);
381 };
382
383 # news.notice                     /var/log/news/news.notice
384 log {
385         source(s_all);
386 <% if hostname == "heininen" -%>
387         source(s_network);
388 <% end %>
389         filter(f_news);
390         filter(f_at_least_notice);
391         destination(df_news_dot_notice);
392 };
393
394
395 # *.=debug;\
396 #         auth,authpriv.none;\
397 #         news.none;mail.none     -/var/log/debug
398 log {
399         source(s_all);
400 <% if hostname == "heininen" -%>
401         source(s_network);
402 <% end %>
403         filter(f_debug);
404         destination(df_debug);
405 };
406
407
408 # *.=info;*.=notice;*.=warn;\
409 #         auth,authpriv.none;\
410 #         cron,daemon.none;\
411 #         mail,news.none          -/var/log/messages
412 log {
413         source(s_all);
414 <% if hostname == "heininen" -%>
415         source(s_network);
416 <% end %>
417         filter(f_messages);
418         destination(df_messages);
419 };
420
421 # *.emerg                         *
422 log {
423         source(s_all);
424 <% if hostname == "heininen" -%>
425         source(s_network);
426 <% end %>
427         filter(f_emerg);
428         destination(du_all);
429 };
430
431
432 <% if kernel == 'Linux' %>
433 # daemon.*;mail.*;\
434 #         news.crit;news.err;news.notice;\
435 #         *.=debug;*.=info;\
436 #         *.=notice;*.=warn       |/dev/xconsole
437 log {
438         source(s_all);
439 <% if hostname == "heininen" -%>
440         source(s_network);
441 <% end %>
442         filter(f_xconsole);
443         destination(dp_xconsole);
444 };
445 <%end%>
446
447 <% if hostname == "corelli" -%>
448 destination loghost-paganini {
449         udp("192.168.2.10",port(514));
450 };
451
452 log {
453         source(s_all);
454         destination(loghost-paganini);
455 };
456 <%end%>