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