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