1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
|
#############################################################################
# Simple syslog-ng.conf for crux.nu,
#
# Silvino Silva < silvino at bk dot ru >
# Created: 1/12/2014
#
# Reference:
# http://www.campin.net/syslog-ng/expanded-syslog-ng.con
#
# Notes:
# * f_error and f_console are not used
# --------------------------------------------------------------------------
@version: 3.5
@include "scl.conf"
options {
flush_lines(0);
time_reopen(10);
chain_hostnames(off);
create_dirs(no);
stats_freq(1200);
use_dns(no);
use_fqdn(no);
perm(0600);
log_fifo_size(2048);
log_msg_size(1024);
keep_hostname(yes);
};
#############################################
# sources
#
source s_log { unix-dgram("/dev/log"); };
source s_internal { internal(); };
source s_kernel { file("/proc/kmsg" program_override("kernel")); };
template t_debug { template("$DATE fac $FACILITY lvl $LEVEL prg $PROGRAM: $MSG\n"); };
#############################################
# common destinations
#
destination d_auth { file("/var/log/auth"); };
destination d_cron { file("/var/log/cron"); };
destination d_daemon { file("/var/log/daemon"); };
destination d_kernel { file("/var/log/kernel"); };
destination d_lpr { file("/var/log/lpr"); };
destination d_mail { file("/var/log/mail"); };
destination d_user { file("/var/log/user"); };
destination d_syslog { file("/val/log/syslog"); };
destination d_debug { file("/var/log/debug" template(t_debug)); };
destination d_error { file("/var/log/error"); };
destination d_messages { file("/var/log/messages"); };
destination d_console { usertty("root"); };
destination d_console_all { usertty("root"); };
#############################################
# custom destinations
#
destination d_shorewall_warn { file ("/var/log/shorewall/warn.log"); };
destination d_shorewall_info { file ("/var/log/shorewall/info.log"); };
destination d_dnsmasq { file("/var/log/dnsmasq"); };
destination d_postgres { file("/var/log/pgsql"); };
destination d_iptables { file("/var/log/iptables"); };
destination d_sshd { file("/var/log/sshd"); };
destination d_gitolite { file("/var/log/gitolite"); };
destination d_nginx_access { file("/var/log/nginx/access.log" owner(root) group(www) perm(0644)); };
destination d_nginx_error { file("/var/log/nginx/error.log"); };
#############################################
# common filters
#
filter f_info { level(info); };
filter f_notice { level(notice); };
filter f_warn { level(warn); };
filter f_err { level(err); };
filter f_crit { level(crit .. emerg); };
filter f_emerg { level(emerg); };
filter f_alert { level(alert); };
filter f_debug {
level(debug)
and not facility(auth, authpriv, mail, news)
};
filter f_error { level(err..emerg); };
filter f_auth { facility(auth, authpriv); };
filter f_cron { facility(cron); };
filter f_daemon { facility(daemon); };
filter f_kernel { facility(kern); };
filter f_lpr { facility(lpr); };
filter f_local { facility(
local0,
local1,
local2,
local3,
local4,
local5,
local6,
local7
);
};
filter f_mail { facility(mail); };
filter f_syslog { facility(syslog); };
filter f_user { facility(user); };
filter f_console { level(warn .. emerg); };
#############################################
# custom filters
#
filter f_messages {
level(info..warn)
and not facility(auth, authpriv, mail, cron)
};
filter f_dnsmasq { program("dnsmasq"); };
filter f_postgres { facility(local0); };
filter f_sshd { facility(local1); };
filter f_iptables {
facility(kern)
and match("iptables" value("MESSAGE"))
};
filter f_shorewall_warn {
level (warn)
and match ("Shorewall" value("MESSAGE"));
};
filter f_shorewall_info {
level (info)
and match ("Shorewall" value("MESSAGE"));
};
filter f_gitolite { program("gitolite"); };
filter f_nginx_access {
match("nginx_access:" value("MESSAGE"));
};
filter f_nginx_error {
match("nginx_error:" value("MESSAGE"));
};
log { source (s_kernel); filter (f_iptables); destination (d_iptables); flags(final);};
log { source (s_kernel); filter (f_shorewall_warn); destination (d_shorewall_warn); flags(final);};
log { source (s_kernel); filter (f_shorewall_info); destination (d_shorewall_info); flags(final);};
log { source(s_log); filter(f_dnsmasq); destination(d_dnsmasq); flags(final); };
log { source(s_log); filter(f_postgres); destination(d_postgres); flags(final); };
log { source(s_log); filter(f_sshd); destination(d_sshd); flags(final); };
log { source(s_log); filter(f_gitolite); destination(d_gitolite); flags(final); };
log { source(s_log); filter(f_nginx_error); destination(d_nginx_error); flags(final); };
log { source(s_log); filter(f_local); filter(f_nginx_access); destination(d_nginx_access); flags(final); };
#############################################
# connect filter and destination
#
log { source(s_log); filter(f_auth); destination(d_auth); };
log { source(s_log); filter(f_cron); destination(d_cron); };
log { source(s_log); filter(f_daemon); destination(d_daemon); };
log { source(s_kernel); filter(f_kernel); destination(d_kernel); };
log { source(s_log); filter(f_lpr); destination(d_lpr); };
log { source(s_log); source(s_internal); filter(f_syslog); destination(d_syslog); };
log { source(s_log); filter(f_user); destination(d_user); };
log { source(s_log); filter(f_mail); destination(d_mail); };
log { source(s_log); filter(f_mail); filter(f_info); destination(d_mail); };
log { source(s_log); filter(f_mail); filter(f_info); destination(d_mail); };
log { source(s_log); filter(f_mail); filter(f_info); destination(d_mail); };
log { source(s_log); filter(f_debug); destination(d_debug); };
log { source(s_log); filter(f_error); destination(d_error); };
#log { source(s_log); filter(f_console); destination(d_console_all); };
log { source(s_log); filter(f_crit); destination(d_console); };
#default log
log { source(s_log); filter(f_messages); destination(d_messages); };
|