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