f811df49f6104a153e211cfc0875a6d1384213de
[mirror/dsa-puppet.git] / templates / syslog-ng.conf.erb
1 ##
2 ## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE.
3 ## USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git
4 ##
5
6 #
7 # Configuration file for syslog-ng under Debian
8 #
9 # attempts at reproducing default syslog behavior
10
11 # the standard syslog levels are (in descending order of priority):
12 # emerg alert crit err warning notice info debug
13 # the aliases "error", "panic", and "warn" are deprecated
14 # the "none" priority found in the original syslogd configuration is
15 # only used in internal messages created by syslogd
16
17
18 ######
19 # options
20
21 options {
22         # disable the chained hostname format in logs
23         # (default is enabled)
24         chain_hostnames(0);
25
26         # the time to wait before a died connection is re-established
27         # (default is 60)
28         time_reopen(10);
29
30         # the time to wait before an idle destination file is closed
31         # (default is 60)
32         time_reap(360);
33
34         # the number of lines buffered before written to file
35         # you might want to increase this if your disk isn't catching with
36         # all the log messages you get or if you want less disk activity
37         # (say on a laptop)
38         # (default is 0)
39         #sync(0);
40
41         # the number of lines fitting in the output queue
42         log_fifo_size(2048);
43
44         # enable or disable directory creation for destination files
45         create_dirs(yes);
46
47         # default owner, group, and permissions for log files
48         # (defaults are 0, 0, 0600)
49         #owner(root);
50         group(adm);
51         perm(0640);
52
53         # default owner, group, and permissions for created directories
54         # (defaults are 0, 0, 0700)
55         #dir_owner(root);
56         #dir_group(root);
57         dir_perm(0755);
58
59         # enable or disable DNS usage
60         # syslog-ng blocks on DNS queries, so enabling DNS may lead to
61         # a Denial of Service attack
62         # (default is yes)
63         use_dns(no);
64
65         # maximum length of message in bytes
66         # this is only limited by the program listening on the /dev/log Unix
67         # socket, glibc can handle arbitrary length log messages, but -- for
68         # example -- syslogd accepts only 1024 bytes
69         # (default is 2048)
70         #log_msg_size(2048);
71
72         #Disable statistic log messages.
73         stats_freq(0);
74
75         # Some program send log messages through a private implementation.
76         # and sometimes that implementation is bad. If this happen syslog-ng
77         # may recognise the program name as hostname. Whit this option
78         # we tell the syslog-ng that if a hostname match this regexp than that
79         # is not a real hostname.
80         bad_hostname("^gconfd$");
81 };
82
83
84 ######
85 # sources
86
87 # all known message sources
88 source s_all {
89         # message generated by Syslog-NG
90         internal();
91 <% if kernel == 'Linux' %>
92         # standard Linux log source (this is the default place for the syslog()
93         # function to send logs to)
94         unix-stream("/dev/log");
95         # messages from the kernel
96         file("/proc/kmsg" log_prefix("kernel: "));
97 <% else %>
98         # standard Linux log source (this is the default place for the syslog()
99         # function to send logs to)
100         unix-dgram("/var/run/log");
101         # messages from the kernel
102         file("/dev/klog" log_prefix("kernel: "));
103 <%end%>
104         # use the following line if you want to receive remote UDP logging messages
105         # (this is equivalent to the "-r" syslogd flag)
106         # udp();
107 };
108
109
110 ######
111 # destinations
112
113 # some standard log files
114 destination df_auth { file("/var/log/auth.log"); };
115 destination df_syslog { file("/var/log/syslog"); };
116 destination df_cron { file("/var/log/cron.log"); };
117 destination df_daemon { file("/var/log/daemon.log"); };
118 destination df_kern { file("/var/log/kern.log"); };
119 destination df_lpr { file("/var/log/lpr.log"); };
120 destination df_mail { file("/var/log/mail.log" group(maillog)); };
121 destination df_mail_info { file("/var/log/mail.info" group(maillog)); };
122 destination df_mail_warn { file("/var/log/mail.warn" group(maillog)); };
123 destination df_mail_err { file("/var/log/mail.err" group(maillog)); };
124 destination df_user { file("/var/log/user.log" perm(0644)); };
125 destination df_uucp { file("/var/log/uucp.log"); };
126
127 # these files are meant for the mail system log files
128 # and provide re-usable destinations for {mail,cron,...}.info,
129 # {mail,cron,...}.notice, etc.
130 destination df_facility_dot_info { file("/var/log/$FACILITY.info"); };
131 destination df_facility_dot_notice { file("/var/log/$FACILITY.notice"); };
132 destination df_facility_dot_warn { file("/var/log/$FACILITY.warn"); };
133 destination df_facility_dot_err { file("/var/log/$FACILITY.err"); };
134 destination df_facility_dot_crit { file("/var/log/$FACILITY.crit"); };
135
136 # these files are meant for the news system, and are kept separated
137 # because they should be owned by "news" instead of "root"
138 destination df_news_dot_notice { file("/var/log/news/news.notice" owner("news")); };
139 destination df_news_dot_err { file("/var/log/news/news.err" owner("news")); };
140 destination df_news_dot_crit { file("/var/log/news/news.crit" owner("news")); };
141
142 # some more classical and useful files found in standard syslog configurations
143 destination df_debug { file("/var/log/debug"); };
144 destination df_messages { file("/var/log/messages"); };
145
146 <% if kernel == 'Linux' %>
147 # pipes
148 # a console to view log messages under X
149 destination dp_xconsole { pipe("/dev/xconsole"); };
150
151 <% end %>
152 # consoles
153 # this will send messages to everyone logged in
154 destination du_all { usertty("*"); };
155
156
157 ######
158 # filters
159
160 # all messages from the auth and authpriv facilities
161 filter f_auth { facility(auth, authpriv); };
162
163 # all messages except from the auth and authpriv facilities
164 filter f_syslog { not facility(auth, authpriv); };
165
166 # respectively: messages from the cron, daemon, kern, lpr, mail, news, user,
167 # and uucp facilities
168 filter f_cron { facility(cron); };
169 filter f_daemon { facility(daemon); };
170 filter f_kern { facility(kern); };
171 filter f_lpr { facility(lpr); };
172 filter f_mail { facility(mail); };
173 filter f_news { facility(news); };
174 filter f_user { facility(user); };
175 filter f_uucp { facility(uucp); };
176
177 # some filters to select messages of priority greater or equal to info, warn,
178 # and err
179 # (equivalents of syslogd's *.info, *.warn, and *.err)
180 filter f_at_least_info { level(info..emerg); };
181 filter f_at_least_notice { level(notice..emerg); };
182 filter f_at_least_warn { level(warn..emerg); };
183 filter f_at_least_err { level(err..emerg); };
184 filter f_at_least_crit { level(crit..emerg); };
185
186 # all messages of priority debug not coming from the auth, authpriv, news, and
187 # mail facilities
188 filter f_debug { level(debug) and not facility(auth, authpriv, news, mail); };
189
190 # all messages of info, notice, or warn priority not coming form the auth,
191 # authpriv, cron, daemon, mail, and news facilities
192 filter f_messages {
193         level(info,notice,warn)
194             and not facility(auth,authpriv,cron,daemon,mail,news);
195 };
196
197 # messages with priority emerg
198 filter f_emerg { level(emerg); };
199
200 <% if kernel == 'Linux' %>
201 # complex filter for messages usually sent to the xconsole
202 filter f_xconsole {
203     facility(daemon,mail)
204         or level(debug,info,notice,warn)
205         or (facility(news)
206                 and level(crit,err,notice));
207 };
208
209 <% end %>
210 ######
211 # logs
212 # order matters if you use "flags(final);" to mark the end of processing in a
213 # "log" statement
214
215 # these rules provide the same behavior as the commented original syslogd rules
216
217 # auth,authpriv.*                 /var/log/auth.log
218 log {
219         source(s_all);
220         filter(f_auth);
221         destination(df_auth);
222 };
223
224 # *.*;auth,authpriv.none          -/var/log/syslog
225 log {
226         source(s_all);
227         filter(f_syslog);
228         destination(df_syslog);
229 };
230
231 # this is commented out in the default syslog.conf
232 # cron.*                         /var/log/cron.log
233 #log {
234 #        source(s_all);
235 #        filter(f_cron);
236 #        destination(df_cron);
237 #};
238
239 # daemon.*                        -/var/log/daemon.log
240 log {
241         source(s_all);
242         filter(f_daemon);
243         destination(df_daemon);
244 };
245
246 # kern.*                          -/var/log/kern.log
247 log {
248         source(s_all);
249         filter(f_kern);
250         destination(df_kern);
251 };
252
253 # lpr.*                           -/var/log/lpr.log
254 log {
255         source(s_all);
256         filter(f_lpr);
257         destination(df_lpr);
258 };
259
260 # mail.*                          -/var/log/mail.log
261 log {
262         source(s_all);
263         filter(f_mail);
264         destination(df_mail);
265 };
266
267 # user.*                          -/var/log/user.log
268 log {
269         source(s_all);
270         filter(f_user);
271         destination(df_user);
272 };
273
274 # uucp.*                          /var/log/uucp.log
275 log {
276         source(s_all);
277         filter(f_uucp);
278         destination(df_uucp);
279 };
280
281 # mail.info                       -/var/log/mail.info
282 log {
283         source(s_all);
284         filter(f_mail);
285         filter(f_at_least_info);
286         destination(df_mail_info);
287 };
288
289 # mail.warn                       -/var/log/mail.warn
290 log {
291         source(s_all);
292         filter(f_mail);
293         filter(f_at_least_warn);
294         destination(df_mail_warn);
295 };
296
297 # mail.err                        /var/log/mail.err
298 log {
299         source(s_all);
300         filter(f_mail);
301         filter(f_at_least_err);
302         destination(df_mail_err);
303 };
304
305 # news.crit                       /var/log/news/news.crit
306 log {
307         source(s_all);
308         filter(f_news);
309         filter(f_at_least_crit);
310         destination(df_news_dot_crit);
311 };
312
313 # news.err                        /var/log/news/news.err
314 log {
315         source(s_all);
316         filter(f_news);
317         filter(f_at_least_err);
318         destination(df_news_dot_err);
319 };
320
321 # news.notice                     /var/log/news/news.notice
322 log {
323         source(s_all);
324         filter(f_news);
325         filter(f_at_least_notice);
326         destination(df_news_dot_notice);
327 };
328
329
330 # *.=debug;\
331 #         auth,authpriv.none;\
332 #         news.none;mail.none     -/var/log/debug
333 log {
334         source(s_all);
335         filter(f_debug);
336         destination(df_debug);
337 };
338
339
340 # *.=info;*.=notice;*.=warn;\
341 #         auth,authpriv.none;\
342 #         cron,daemon.none;\
343 #         mail,news.none          -/var/log/messages
344 log {
345         source(s_all);
346         filter(f_messages);
347         destination(df_messages);
348 };
349
350 # *.emerg                         *
351 log {
352         source(s_all);
353         filter(f_emerg);
354         destination(du_all);
355 };
356
357
358 <% if kernel == 'Linux' %>
359 # daemon.*;mail.*;\
360 #         news.crit;news.err;news.notice;\
361 #         *.=debug;*.=info;\
362 #         *.=notice;*.=warn       |/dev/xconsole
363 log {
364         source(s_all);
365         filter(f_xconsole);
366         destination(dp_xconsole);
367 };
368 <%end%>