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