]> git.donarmstrong.com Git - dsa-puppet.git/blob - modules/syslog-ng/templates/syslog-ng.conf.erb
546bf1cb5de0a3bcf4daeeb37c0e2461d629f2b7
[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 };
121
122 <%- if (hostname == "lotti") || (hostname == "lully") -%>
123 source s_network {
124         tcp6(port(5140) max-connections(200)
125                 tls( key_file("/etc/exim4/ssl/thishost.key")
126                      cert_file("/etc/exim4/ssl/thishost.crt")
127                      ca_dir("/etc/exim4/ssl/")
128                 )
129         );
130 };
131 <%- end -%>
132
133
134 ######
135 # destinations
136
137 # some standard log files
138 destination df_auth { file("/var/log/auth.log"); };
139 destination df_syslog { file("/var/log/syslog"); };
140 destination df_cron { file("/var/log/cron.log"); };
141 destination df_daemon { file("/var/log/daemon.log"); };
142 destination df_kern { file("/var/log/kern.log"); };
143 destination df_lpr { file("/var/log/lpr.log"); };
144 destination df_mail { file("/var/log/mail.log" group(maillog)); };
145 # destination df_mail_info { file("/var/log/mail.info" group(maillog)); };
146 destination df_mail_warn { file("/var/log/mail.warn" group(maillog)); };
147 destination df_mail_err { file("/var/log/mail.err" group(maillog)); };
148 destination df_user { file("/var/log/user.log" perm(0644)); };
149 destination df_uucp { file("/var/log/uucp.log"); };
150
151 # these files are meant for the mail system log files
152 # and provide re-usable destinations for {mail,cron,...}.info,
153 # {mail,cron,...}.notice, etc.
154 destination df_facility_dot_info { file("/var/log/$FACILITY.info"); };
155 destination df_facility_dot_notice { file("/var/log/$FACILITY.notice"); };
156 destination df_facility_dot_warn { file("/var/log/$FACILITY.warn"); };
157 destination df_facility_dot_err { file("/var/log/$FACILITY.err"); };
158 destination df_facility_dot_crit { file("/var/log/$FACILITY.crit"); };
159
160 # these files are meant for the news system, and are kept separated
161 # because they should be owned by "news" instead of "root"
162 destination df_news_dot_notice { file("/var/log/news/news.notice" owner("news")); };
163 destination df_news_dot_err { file("/var/log/news/news.err" owner("news")); };
164 destination df_news_dot_crit { file("/var/log/news/news.crit" owner("news")); };
165
166 # some more classical and useful files found in standard syslog configurations
167 destination df_debug { file("/var/log/debug"); };
168 destination df_messages { file("/var/log/messages"); };
169
170 <%- if kernel == 'Linux' -%>
171 # pipes
172 # a console to view log messages under X
173 destination dp_xconsole { pipe("/dev/xconsole"); };
174
175 <%- end -%>
176 # consoles
177 # this will send messages to everyone logged in
178 destination du_all { usertty("*"); };
179
180
181 ######
182 # filters
183
184 # all messages from the auth and authpriv facilities
185 filter f_auth { facility(auth, authpriv); };
186
187 # all messages except from the auth and authpriv facilities
188 filter f_syslog { not facility(auth, authpriv, mail); };
189
190 # respectively: messages from the cron, daemon, kern, lpr, mail, news, user,
191 # and uucp facilities
192 filter f_cron { facility(cron); };
193 filter f_daemon { facility(daemon); };
194 filter f_kern { facility(kern); };
195 filter f_lpr { facility(lpr); };
196 filter f_mail { facility(mail); };
197 filter f_news { facility(news); };
198 filter f_user { facility(user); };
199 filter f_uucp { facility(uucp); };
200
201 # some filters to select messages of priority greater or equal to info, warn,
202 # and err
203 # (equivalents of syslogd's *.info, *.warn, and *.err)
204 filter f_at_least_info { level(info..emerg); };
205 filter f_at_least_notice { level(notice..emerg); };
206 filter f_at_least_warn { level(warn..emerg); };
207 filter f_at_least_err { level(err..emerg); };
208 filter f_at_least_crit { level(crit..emerg); };
209
210 # all messages of priority debug not coming from the auth, authpriv, news, and
211 # mail facilities
212 filter f_debug { level(debug) and not facility(auth, authpriv, news, mail); };
213
214 # all messages of info, notice, or warn priority not coming form the auth,
215 # authpriv, cron, daemon, mail, and news facilities
216 filter f_messages {
217         level(info,notice,warn)
218             and not facility(auth,authpriv,cron,daemon,mail,news);
219 };
220
221 # messages with priority emerg
222 filter f_emerg { level(emerg); };
223
224 <%- if kernel == 'Linux' -%>
225 # complex filter for messages usually sent to the xconsole
226 filter f_xconsole {
227     facility(daemon,mail)
228         or level(debug,info,notice,warn)
229         or (facility(news)
230                 and level(crit,err,notice));
231 };
232
233 <%- end -%>
234
235 # order matters if you use "flags(final);" to mark the end of processing in a
236 # "log" statement
237
238 ###############################################################################
239 ########## ON LOG CLIENTS #####################################################
240 ###############################################################################
241 ###############################################################################
242 ###############################################################################
243 # all log clients, including the log server, log their locally created
244 # messages to the standard places.
245
246 # auth,authpriv.*                 /var/log/auth.log
247 log {
248         source(s_local);
249         filter(f_auth);
250         destination(df_auth);
251 };
252
253 # *.*;auth,authpriv.none          -/var/log/syslog
254 log {
255         source(s_local);
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_local);
264 #        filter(f_cron);
265 #        destination(df_cron);
266 #};
267
268 # daemon.*                        -/var/log/daemon.log
269 log {
270         source(s_local);
271         filter(f_daemon);
272         destination(df_daemon);
273 };
274
275 # kern.*                          -/var/log/kern.log
276 log {
277         source(s_local);
278         filter(f_kern);
279         destination(df_kern);
280 };
281
282 # lpr.*                           -/var/log/lpr.log
283 log {
284         source(s_local);
285         filter(f_lpr);
286         destination(df_lpr);
287 };
288
289 # mail.*                          -/var/log/mail.log
290 log {
291         source(s_local);
292         filter(f_mail);
293         destination(df_mail);
294 };
295
296 # user.*                          -/var/log/user.log
297 log {
298         source(s_local);
299         filter(f_user);
300         destination(df_user);
301 };
302
303 # uucp.*                          /var/log/uucp.log
304 log {
305         source(s_local);
306         filter(f_uucp);
307         destination(df_uucp);
308 };
309
310 # mail.info                       -/var/log/mail.info
311 #log {
312 #        source(s_local);
313 #        filter(f_mail);
314 #        filter(f_at_least_info);
315 #        destination(df_mail_info);
316 #};
317
318 # mail.warn                       -/var/log/mail.warn
319 log {
320         source(s_local);
321         filter(f_mail);
322         filter(f_at_least_warn);
323         destination(df_mail_warn);
324 };
325
326 # mail.err                        /var/log/mail.err
327 log {
328         source(s_local);
329         filter(f_mail);
330         filter(f_at_least_err);
331         destination(df_mail_err);
332 };
333
334 # news.crit                       /var/log/news/news.crit
335 log {
336         source(s_local);
337         filter(f_news);
338         filter(f_at_least_crit);
339         destination(df_news_dot_crit);
340 };
341
342 # news.err                        /var/log/news/news.err
343 log {
344         source(s_local);
345         filter(f_news);
346         filter(f_at_least_err);
347         destination(df_news_dot_err);
348 };
349
350 # news.notice                     /var/log/news/news.notice
351 log {
352         source(s_local);
353         filter(f_news);
354         filter(f_at_least_notice);
355         destination(df_news_dot_notice);
356 };
357
358
359 # *.=debug;\
360 #         auth,authpriv.none;\
361 #         news.none;mail.none     -/var/log/debug
362 log {
363         source(s_local);
364         filter(f_debug);
365         destination(df_debug);
366 };
367
368
369 # *.=info;*.=notice;*.=warn;\
370 #         auth,authpriv.none;\
371 #         cron,daemon.none;\
372 #         mail,news.none          -/var/log/messages
373 log {
374         source(s_local);
375         filter(f_messages);
376         destination(df_messages);
377 };
378
379 # *.emerg                         *
380 log {
381         source(s_local);
382         filter(f_emerg);
383         destination(du_all);
384 };
385
386
387 <%- if kernel == 'Linux' -%>
388 # daemon.*;mail.*;\
389 #         news.crit;news.err;news.notice;\
390 #         *.=debug;*.=info;\
391 #         *.=notice;*.=warn       |/dev/xconsole
392 log {
393         source(s_local);
394         filter(f_xconsole);
395         destination(dp_xconsole);
396 };
397 <%- end -%>
398
399
400  <%- if hostname != "lotti" -%>
401 destination loghost-lotti {
402         tcp("lotti.debian.org" port (5140)
403                 tls( key_file("/etc/ssl/debian/keys/thishost.key")
404                      cert_file("/etc/ssl/debian/certs/thishost.crt")
405                      ca_dir("/etc/ssl/debian/certs/")
406                 )
407         );
408 };
409  <%- end -%>
410   <%- if hostname != "lully" -%>
411 destination loghost-lully {
412         tcp("lully.debian.org" port (5140)
413                 tls( key_file("/etc/ssl/debian/keys/thishost.key")
414                      cert_file("/etc/ssl/debian/certs/thishost.crt")
415                      ca_dir("/etc/ssl/debian/certs/")
416                 )
417         );
418 };
419  <%- end -%>
420
421 log {
422         source(s_local);
423  <%- if hostname != "lotti" -%>
424         destination(loghost-lotti);
425  <%- end -%>
426  <%- if hostname != "lully" -%>
427         destination(loghost-lully);
428  <%- end -%>
429 };
430
431
432
433 <%- if (hostname == "lotti") || (hostname == "lully") -%>
434 ###############################################################################
435 ########## ON LOG HOST ########################################################
436 ###############################################################################
437 ###############################################################################
438 #
439 # The log server, additionally, also logs all local and remote messages to
440 # a few special places.
441 destination hostdest_auth           { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/auth.log"
442                                       owner(root) group(adm) perm(0640) dir_perm(0755) create_dirs(yes) dir_owner(root) dir_group(adm)); };
443 destination hostdest_syslog         { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/syslog"
444                                       owner(root) group(adm) perm(0640) dir_perm(0755) create_dirs(yes) dir_owner(root) dir_group(adm)); };
445 destination hostdest_cron           { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/cron.log"
446                                       owner(root) group(adm) perm(0640) dir_perm(0755) create_dirs(yes) dir_owner(root) dir_group(adm)); };
447 destination hostdest_daemon         { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/daemon.log"
448                                       owner(root) group(adm) perm(0640) dir_perm(0755) create_dirs(yes) dir_owner(root) dir_group(adm)); };
449 destination hostdest_kern           { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/kern.log"
450                                       owner(root) group(adm) perm(0640) dir_perm(0755) create_dirs(yes) dir_owner(root) dir_group(adm)); };
451 destination hostdest_lpr            { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/lpr.log"
452                                       owner(root) group(adm) perm(0640) dir_perm(0755) create_dirs(yes) dir_owner(root) dir_group(adm)); };
453 destination hostdest_mail           { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/mail.log"
454                                       owner(root) group(adm) perm(0640) dir_perm(0755) create_dirs(yes) dir_owner(root) dir_group(adm)); };
455 destination hostdest_news           { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/news.log"
456                                       owner(root) group(adm) perm(0640) dir_perm(0755) create_dirs(yes) dir_owner(root) dir_group(adm)); };
457 destination hostdest_user           { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/user.log"
458                                       owner(root) group(adm) perm(0640) dir_perm(0755) create_dirs(yes) dir_owner(root) dir_group(adm)); };
459 destination hostdest_uucp           { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/uucp.log"
460                                       owner(root) group(adm) perm(0640) dir_perm(0755) create_dirs(yes) dir_owner(root) dir_group(adm)); };
461 destination hostdest_debug          { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/debug"
462                                       owner(root) group(adm) perm(0640) dir_perm(0755) create_dirs(yes) dir_owner(root) dir_group(adm)); };
463 destination hostdest_messages       { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/messages"
464                                       owner(root) group(adm) perm(0640) dir_perm(0755) create_dirs(yes) dir_owner(root) dir_group(adm)); };
465
466
467 #----------------------------------------------------------------------
468 #  Special catch all destination hostdest_sorting by host
469 #----------------------------------------------------------------------
470 destination hostdest_facility_dot_info   { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/$FACILITY.info"
471                                            owner(root) group(adm) perm(0640) dir_perm(0755) create_dirs(yes) dir_owner(root) dir_group(adm)); };
472 destination hostdest_facility_dot_notice { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/$FACILITY.notice"
473                                            owner(root) group(adm) perm(0640) dir_perm(0755) create_dirs(yes) dir_owner(root) dir_group(adm)); };
474 destination hostdest_facility_dot_warn   { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/$FACILITY.warn"
475                                            owner(root) group(adm) perm(0640) dir_perm(0755) create_dirs(yes) dir_owner(root) dir_group(adm)); };
476 destination hostdest_facility_dot_err    { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/$FACILITY.err"
477                                            owner(root) group(adm) perm(0640) dir_perm(0755) create_dirs(yes) dir_owner(root) dir_group(adm)); };
478 destination hostdest_facility_dot_crit   { file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/$FACILITY.crit"
479                                            owner(root) group(adm) perm(0640) dir_perm(0755) create_dirs(yes) dir_owner(root) dir_group(adm)); };
480
481
482 #----------------------------------------------------------------------
483 #  Catch all log files
484 #----------------------------------------------------------------------
485 destination df_ALL_auth { file("/var/log/auth-all.log"); };
486 destination df_ALL_mail { file("/var/log/mail-all.log"); };
487 destination df_ALL_syslog { file("/var/log/syslog-all"); };
488
489 log { source(s_local);
490       source(s_network);
491       filter(f_auth); destination(hostdest_auth); };
492 log { source(s_local);
493       source(s_network);
494       filter(f_syslog); destination(hostdest_syslog); };
495 log { source(s_local);
496       source(s_network);
497       filter(f_daemon); destination(hostdest_daemon); };
498 log { source(s_local);
499       source(s_network);
500       filter(f_kern); destination(hostdest_kern); };
501 log { source(s_local);
502       source(s_network);
503       filter(f_lpr); destination(hostdest_lpr); };
504 log { source(s_local);
505       source(s_network);
506       filter(f_mail); destination(hostdest_mail); };
507 log { source(s_local);
508       source(s_network);
509       filter(f_news); destination(hostdest_mail); };
510 log { source(s_local);
511       source(s_network);
512       filter(f_user); destination(hostdest_user); };
513 log { source(s_local);
514       source(s_network);
515       filter(f_uucp); destination(hostdest_uucp); };
516 log { source(s_local);
517       source(s_network);
518       filter(f_debug); destination(hostdest_debug); };
519 log { source(s_local);
520       source(s_network);
521       filter(f_messages); destination(hostdest_messages); };
522
523 log { source(s_local);
524       source(s_network);
525       filter(f_mail); filter(f_at_least_info); destination(hostdest_facility_dot_info); };
526 log { source(s_local);
527       source(s_network);
528       filter(f_mail); filter(f_at_least_warn); destination(hostdest_facility_dot_warn); };
529 log { source(s_local);
530       source(s_network);
531       filter(f_mail); filter(f_at_least_err); destination(hostdest_facility_dot_err); };
532
533
534 ## catch all:
535 log { source(s_local);
536       source(s_network);
537       filter(f_auth); destination(df_ALL_auth); };
538 log { source(s_local);
539       source(s_network);
540       filter(f_mail); destination(df_ALL_mail); };
541 log { source(s_local);
542       source(s_network);
543       filter(f_syslog); destination(df_ALL_syslog); };
544 <%- end -%>