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