Old syslog-ng is old, move @include inside check for newer ones
[mirror/dsa-puppet.git] / modules / syslog-ng / templates / syslog-ng.conf.erb
1 <%- if has_variable?("syslogversion") and syslogversion.to_s == "3.1" -%>
2 @version: 3.0
3 <%- elsif has_variable?("syslogversion") and syslogversion.to_s == "3.5" -%>
4 @version: 3.5
5 @include "scl.conf"
6 <%- else -%>
7 @version: 3.3
8 @include "scl.conf"
9 <%- end -%>
10
11 ##
12 ## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE.
13 ## USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git
14 ##
15
16 #
17 # Configuration file for syslog-ng under Debian
18 #
19 # attempts at reproducing default syslog behavior
20
21 # the standard syslog levels are (in descending order of priority):
22 # emerg alert crit err warning notice info debug
23 # the aliases "error", "panic", and "warn" are deprecated
24 # the "none" priority found in the original syslogd configuration is
25 # only used in internal messages created by syslogd
26
27
28 ######
29 # options
30
31 options {
32         # disable the chained hostname format in logs
33         # (default is enabled)
34         chain_hostnames(1);
35
36         # the time to wait before a died connection is re-established
37         # (default is 60)
38         time_reopen(10);
39
40         # the time to wait before an idle destination file is closed
41         # (default is 60)
42         time_reap(360);
43
44         # the number of lines buffered before written to file
45         # you might want to increase this if your disk isn't catching with
46         # all the log messages you get or if you want less disk activity
47         # (say on a laptop)
48         # (default is 0)
49         #sync(0);
50
51         # the number of lines fitting in the output queue
52 <%- if has_variable?("syslogversion") and syslogversion.to_s == "3.1" -%>
53         log_fifo_size(2048);
54 <%- else -%>
55         log_fifo_size(10000);
56 <%- end -%>
57
58         # enable or disable directory creation for destination files
59         create_dirs(yes);
60
61         # default owner, group, and permissions for log files
62         # (defaults are 0, 0, 0600)
63         #owner(root);
64         group(adm);
65         perm(0640);
66
67         # default owner, group, and permissions for created directories
68         # (defaults are 0, 0, 0700)
69         #dir_owner(root);
70         #dir_group(root);
71         dir_perm(0755);
72
73         # enable or disable DNS usage
74         # syslog-ng blocks on DNS queries, so enabling DNS may lead to
75         # a Denial of Service attack
76         # (default is yes)
77         use_dns(no);
78
79         # maximum length of message in bytes
80         # this is only limited by the program listening on the /dev/log Unix
81         # socket, glibc can handle arbitrary length log messages, but -- for
82         # example -- syslogd accepts only 1024 bytes
83         # (default is 2048)
84         #log_msg_size(2048);
85
86         #Disable statistic log messages.
87         stats_freq(0);
88
89         # Some program send log messages through a private implementation.
90         # and sometimes that implementation is bad. If this happen syslog-ng
91         # may recognise the program name as hostname. Whit this option
92         # we tell the syslog-ng that if a hostname match this regexp than that
93         # is not a real hostname.
94         bad_hostname("^gconfd$");
95
96         keep_hostname(no);
97
98         # We believe our own clock more than we believe the client clock.
99         keep_timestamp(no);
100 };
101
102
103 ######
104 # sources
105
106 # all known message sources
107 source s_local {
108         # message generated by Syslog-NG
109         internal();
110         system();
111 };
112
113 <%- if (hostname == "lotti") || (hostname == "lully") || (hostname == "loghost-grnet-01") -%>
114 source s_network {
115         tcp6(port(5140) max-connections(200)
116                 tls( key_file("/etc/exim4/ssl/thishost.key")
117                      cert_file("/etc/exim4/ssl/thishost.crt")
118                      ca_dir("/etc/exim4/ssl/")
119                 )
120         );
121 };
122 <%- end -%>
123
124
125 ######
126 # destinations
127
128 # some standard log files
129 destination df_auth { file("/var/log/auth.log"); };
130 destination df_syslog { file("/var/log/syslog"); };
131 destination df_cron { file("/var/log/cron.log"); };
132 destination df_daemon { file("/var/log/daemon.log"); };
133 destination df_kern { file("/var/log/kern.log"); };
134 destination df_lpr { file("/var/log/lpr.log"); };
135 destination df_mail { file("/var/log/mail.log" group(maillog)); };
136 # destination df_mail_info { file("/var/log/mail.info" group(maillog)); };
137 destination df_mail_warn { file("/var/log/mail.warn" group(maillog)); };
138 destination df_mail_err { file("/var/log/mail.err" group(maillog)); };
139 destination df_user { file("/var/log/user.log" perm(0644)); };
140 destination df_uucp { file("/var/log/uucp.log"); };
141
142 # these files are meant for the mail system log files
143 # and provide re-usable destinations for {mail,cron,...}.info,
144 # {mail,cron,...}.notice, etc.
145 destination df_facility_dot_info { file("/var/log/$FACILITY.info"); };
146 destination df_facility_dot_notice { file("/var/log/$FACILITY.notice"); };
147 destination df_facility_dot_warn { file("/var/log/$FACILITY.warn"); };
148 destination df_facility_dot_err { file("/var/log/$FACILITY.err"); };
149 destination df_facility_dot_crit { file("/var/log/$FACILITY.crit"); };
150
151 # these files are meant for the news system, and are kept separated
152 # because they should be owned by "news" instead of "root"
153 destination df_news_dot_notice { file("/var/log/news/news.notice" owner("news")); };
154 destination df_news_dot_err { file("/var/log/news/news.err" owner("news")); };
155 destination df_news_dot_crit { file("/var/log/news/news.crit" owner("news")); };
156
157 # some more classical and useful files found in standard syslog configurations
158 destination df_debug { file("/var/log/debug"); };
159 destination df_messages { file("/var/log/messages"); };
160
161 <%- if kernel == 'Linux' -%>
162 # pipes
163 # a console to view log messages under X
164 destination dp_xconsole { pipe("/dev/xconsole"); };
165
166 <%- end -%>
167 # consoles
168 # this will send messages to everyone logged in
169 destination du_all { usertty("*"); };
170
171
172 ######
173 # filters
174
175 # all messages from the auth and authpriv facilities
176 filter f_auth { facility(auth, authpriv); };
177
178 # all messages except from the auth and authpriv facilities
179 filter f_syslog { not facility(auth, authpriv, mail); };
180
181 # respectively: messages from the cron, daemon, kern, lpr, mail, news, user,
182 # and uucp facilities
183 filter f_cron { facility(cron); };
184 filter f_daemon { facility(daemon); };
185 filter f_kern { facility(kern); };
186 filter f_lpr { facility(lpr); };
187 filter f_mail { facility(mail); };
188 filter f_news { facility(news); };
189 filter f_user { facility(user); };
190 filter f_uucp { facility(uucp); };
191
192 # some filters to select messages of priority greater or equal to info, warn,
193 # and err
194 # (equivalents of syslogd's *.info, *.warn, and *.err)
195 filter f_at_least_info { level(info..emerg); };
196 filter f_at_least_notice { level(notice..emerg); };
197 filter f_at_least_warn { level(warn..emerg); };
198 filter f_at_least_err { level(err..emerg); };
199 filter f_at_least_crit { level(crit..emerg); };
200
201 # all messages of priority debug not coming from the auth, authpriv, news, and
202 # mail facilities
203 filter f_debug { level(debug) and not facility(auth, authpriv, news, mail); };
204
205 # all messages of info, notice, or warn priority not coming form the auth,
206 # authpriv, cron, daemon, mail, and news facilities
207 filter f_messages {
208         level(info,notice,warn)
209             and not facility(auth,authpriv,cron,daemon,mail,news);
210 };
211
212 # messages with priority emerg
213 filter f_emerg { level(emerg); };
214
215 <%- if kernel == 'Linux' -%>
216 # complex filter for messages usually sent to the xconsole
217 filter f_xconsole {
218     facility(daemon,mail)
219         or level(debug,info,notice,warn)
220         or (facility(news)
221                 and level(crit,err,notice));
222 };
223
224 <%- end -%>
225
226 # order matters if you use "flags(final);" to mark the end of processing in a
227 # "log" statement
228
229 ###############################################################################
230 ########## ON LOG CLIENTS #####################################################
231 ###############################################################################
232 ###############################################################################
233 ###############################################################################
234 # all log clients, including the log server, log their locally created
235 # messages to the standard places.
236
237 # auth,authpriv.*                 /var/log/auth.log
238 log {
239         source(s_local);
240         filter(f_auth);
241         destination(df_auth);
242 };
243
244 # *.*;auth,authpriv.none          -/var/log/syslog
245 log {
246         source(s_local);
247         filter(f_syslog);
248         destination(df_syslog);
249 };
250
251 # this is commented out in the default syslog.conf
252 # cron.*                         /var/log/cron.log
253 #log {
254 #        source(s_local);
255 #        filter(f_cron);
256 #        destination(df_cron);
257 #};
258
259 # daemon.*                        -/var/log/daemon.log
260 log {
261         source(s_local);
262         filter(f_daemon);
263         destination(df_daemon);
264 };
265
266 # kern.*                          -/var/log/kern.log
267 log {
268         source(s_local);
269         filter(f_kern);
270         destination(df_kern);
271 };
272
273 # lpr.*                           -/var/log/lpr.log
274 log {
275         source(s_local);
276         filter(f_lpr);
277         destination(df_lpr);
278 };
279
280 # mail.*                          -/var/log/mail.log
281 log {
282         source(s_local);
283         filter(f_mail);
284         destination(df_mail);
285 };
286
287 # user.*                          -/var/log/user.log
288 log {
289         source(s_local);
290         filter(f_user);
291         destination(df_user);
292 };
293
294 # uucp.*                          /var/log/uucp.log
295 log {
296         source(s_local);
297         filter(f_uucp);
298         destination(df_uucp);
299 };
300
301 # mail.info                       -/var/log/mail.info
302 #log {
303 #        source(s_local);
304 #        filter(f_mail);
305 #        filter(f_at_least_info);
306 #        destination(df_mail_info);
307 #};
308
309 # mail.warn                       -/var/log/mail.warn
310 log {
311         source(s_local);
312         filter(f_mail);
313         filter(f_at_least_warn);
314         destination(df_mail_warn);
315 };
316
317 # mail.err                        /var/log/mail.err
318 log {
319         source(s_local);
320         filter(f_mail);
321         filter(f_at_least_err);
322         destination(df_mail_err);
323 };
324
325 # news.crit                       /var/log/news/news.crit
326 log {
327         source(s_local);
328         filter(f_news);
329         filter(f_at_least_crit);
330         destination(df_news_dot_crit);
331 };
332
333 # news.err                        /var/log/news/news.err
334 log {
335         source(s_local);
336         filter(f_news);
337         filter(f_at_least_err);
338         destination(df_news_dot_err);
339 };
340
341 # news.notice                     /var/log/news/news.notice
342 log {
343         source(s_local);
344         filter(f_news);
345         filter(f_at_least_notice);
346         destination(df_news_dot_notice);
347 };
348
349
350 # *.=debug;\
351 #         auth,authpriv.none;\
352 #         news.none;mail.none     -/var/log/debug
353 log {
354         source(s_local);
355         filter(f_debug);
356         destination(df_debug);
357 };
358
359
360 # *.=info;*.=notice;*.=warn;\
361 #         auth,authpriv.none;\
362 #         cron,daemon.none;\
363 #         mail,news.none          -/var/log/messages
364 log {
365         source(s_local);
366         filter(f_messages);
367         destination(df_messages);
368 };
369
370 # *.emerg                         *
371 log {
372         source(s_local);
373         filter(f_emerg);
374         destination(du_all);
375 };
376
377
378 <%- if kernel == 'Linux' -%>
379 # daemon.*;mail.*;\
380 #         news.crit;news.err;news.notice;\
381 #         *.=debug;*.=info;\
382 #         *.=notice;*.=warn       |/dev/xconsole
383 log {
384         source(s_local);
385         filter(f_xconsole);
386         destination(dp_xconsole);
387 };
388 <%- end -%>
389
390
391  <%- if hostname != "lotti" -%>
392 destination loghost-lotti {
393         tcp("lotti.debian.org" port (5140)
394                 tls( key_file("/etc/ssl/debian/keys/thishost.key")
395                      cert_file("/etc/ssl/debian/certs/thishost.crt")
396                      ca_dir("/etc/ssl/debian/certs/")
397                 )
398         );
399 };
400  <%- end -%>
401   <%- if hostname != "lully" -%>
402 destination loghost-lully {
403         tcp("lully.debian.org" port (5140)
404                 tls( key_file("/etc/ssl/debian/keys/thishost.key")
405                      cert_file("/etc/ssl/debian/certs/thishost.crt")
406                      ca_dir("/etc/ssl/debian/certs/")
407                 )
408         );
409 };
410  <%- end -%>
411   <%- if hostname != "loghost-grnet-01" -%>
412 destination loghost-loghost-grnet-01 {
413         tcp("loghost-grnet-01.debian.org" port (5140)
414                 tls( key_file("/etc/ssl/debian/keys/thishost.key")
415                      cert_file("/etc/ssl/debian/certs/thishost.crt")
416                      ca_dir("/etc/ssl/debian/certs/")
417                 )
418         );
419 };
420  <%- end -%>
421
422 log {
423         source(s_local);
424  <%- if hostname != "lotti" -%>
425         destination(loghost-lotti);
426  <%- end -%>
427  <%- if hostname != "lully" -%>
428         destination(loghost-lully);
429  <%- end -%>
430  <%- if hostname != "loghost-grnet-01" -%>
431         destination(loghost-loghost-grnet-01);
432  <%- end -%>
433 };
434
435
436
437 <%- if (hostname == "lotti") || (hostname == "lully") || (hostname == "loghost-grnet-01") -%>
438 ###############################################################################
439 ########## ON LOG HOST ########################################################
440 ###############################################################################
441 ###############################################################################
442 #
443 # The log server, additionally, also logs all local and remote messages to
444 # a few special places.
445 destination hostdest_auth           { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/auth.log"
446                                       owner(root) group(adm) perm(0640) dir_perm(0755) create_dirs(yes) dir_owner(root) dir_group(adm)); };
447 destination hostdest_syslog         { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/syslog"
448                                       owner(root) group(adm) perm(0640) dir_perm(0755) create_dirs(yes) dir_owner(root) dir_group(adm)); };
449 destination hostdest_cron           { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/cron.log"
450                                       owner(root) group(adm) perm(0640) dir_perm(0755) create_dirs(yes) dir_owner(root) dir_group(adm)); };
451 destination hostdest_daemon         { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/daemon.log"
452                                       owner(root) group(adm) perm(0640) dir_perm(0755) create_dirs(yes) dir_owner(root) dir_group(adm)); };
453 destination hostdest_kern           { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/kern.log"
454                                       owner(root) group(adm) perm(0640) dir_perm(0755) create_dirs(yes) dir_owner(root) dir_group(adm)); };
455 destination hostdest_lpr            { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/lpr.log"
456                                       owner(root) group(adm) perm(0640) dir_perm(0755) create_dirs(yes) dir_owner(root) dir_group(adm)); };
457 destination hostdest_mail           { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/mail.log"
458                                       owner(root) group(adm) perm(0640) dir_perm(0755) create_dirs(yes) dir_owner(root) dir_group(adm)); };
459 destination hostdest_news           { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/news.log"
460                                       owner(root) group(adm) perm(0640) dir_perm(0755) create_dirs(yes) dir_owner(root) dir_group(adm)); };
461 destination hostdest_user           { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/user.log"
462                                       owner(root) group(adm) perm(0640) dir_perm(0755) create_dirs(yes) dir_owner(root) dir_group(adm)); };
463 destination hostdest_uucp           { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/uucp.log"
464                                       owner(root) group(adm) perm(0640) dir_perm(0755) create_dirs(yes) dir_owner(root) dir_group(adm)); };
465 destination hostdest_debug          { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/debug"
466                                       owner(root) group(adm) perm(0640) dir_perm(0755) create_dirs(yes) dir_owner(root) dir_group(adm)); };
467 destination hostdest_messages       { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/messages"
468                                       owner(root) group(adm) perm(0640) dir_perm(0755) create_dirs(yes) dir_owner(root) dir_group(adm)); };
469
470
471 #----------------------------------------------------------------------
472 #  Special catch all destination hostdest_sorting by host
473 #----------------------------------------------------------------------
474 destination hostdest_facility_dot_info   { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/$FACILITY.info"
475                                            owner(root) group(adm) perm(0640) dir_perm(0755) create_dirs(yes) dir_owner(root) dir_group(adm)); };
476 destination hostdest_facility_dot_notice { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/$FACILITY.notice"
477                                            owner(root) group(adm) perm(0640) dir_perm(0755) create_dirs(yes) dir_owner(root) dir_group(adm)); };
478 destination hostdest_facility_dot_warn   { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/$FACILITY.warn"
479                                            owner(root) group(adm) perm(0640) dir_perm(0755) create_dirs(yes) dir_owner(root) dir_group(adm)); };
480 destination hostdest_facility_dot_err    { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/$FACILITY.err"
481                                            owner(root) group(adm) perm(0640) dir_perm(0755) create_dirs(yes) dir_owner(root) dir_group(adm)); };
482 destination hostdest_facility_dot_crit   { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/$FACILITY.crit"
483                                            owner(root) group(adm) perm(0640) dir_perm(0755) create_dirs(yes) dir_owner(root) dir_group(adm)); };
484
485
486 #----------------------------------------------------------------------
487 #  Catch all log files
488 #----------------------------------------------------------------------
489 destination df_ALL_auth { file("/var/log/auth-all.log"); };
490 destination df_ALL_mail { file("/var/log/mail-all.log"); };
491 destination df_ALL_syslog { file("/var/log/syslog-all"); };
492
493 log { source(s_local);
494       source(s_network);
495       filter(f_auth); destination(hostdest_auth); };
496 log { source(s_local);
497       source(s_network);
498       filter(f_syslog); destination(hostdest_syslog); };
499 log { source(s_local);
500       source(s_network);
501       filter(f_daemon); destination(hostdest_daemon); };
502 log { source(s_local);
503       source(s_network);
504       filter(f_kern); destination(hostdest_kern); };
505 log { source(s_local);
506       source(s_network);
507       filter(f_lpr); destination(hostdest_lpr); };
508 log { source(s_local);
509       source(s_network);
510       filter(f_mail); destination(hostdest_mail); };
511 log { source(s_local);
512       source(s_network);
513       filter(f_news); destination(hostdest_mail); };
514 log { source(s_local);
515       source(s_network);
516       filter(f_user); destination(hostdest_user); };
517 log { source(s_local);
518       source(s_network);
519       filter(f_uucp); destination(hostdest_uucp); };
520 log { source(s_local);
521       source(s_network);
522       filter(f_debug); destination(hostdest_debug); };
523 log { source(s_local);
524       source(s_network);
525       filter(f_messages); destination(hostdest_messages); };
526
527 log { source(s_local);
528       source(s_network);
529       filter(f_mail); filter(f_at_least_info); destination(hostdest_facility_dot_info); };
530 log { source(s_local);
531       source(s_network);
532       filter(f_mail); filter(f_at_least_warn); destination(hostdest_facility_dot_warn); };
533 log { source(s_local);
534       source(s_network);
535       filter(f_mail); filter(f_at_least_err); destination(hostdest_facility_dot_err); };
536
537
538 ## catch all:
539 log { source(s_local);
540       source(s_network);
541       filter(f_auth); destination(df_ALL_auth); };
542 log { source(s_local);
543       source(s_network);
544       filter(f_mail); destination(df_ALL_mail); };
545 log { source(s_local);
546       source(s_network);
547       filter(f_syslog); destination(df_ALL_syslog); };
548 <%- end -%>