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