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