1SYSLOG-NG.CONF(5) The syslog-ng.conf manual page SYSLOG-NG.CONF(5)
2
3
4
6 syslog-ng.conf - syslog-ng configuration file
7
9 syslog-ng.conf
10
12 NOTE: This manual page covers both editions of syslog-ng: syslog-ng
13 Open Source Edition and the commercial syslog-ng Premium Edition.
14 Features that are only included in the Premium Edition are marked with
15 an asterisk (*). For details, see the official syslog-ng website:
16 http://www.balabit.com/network-security/syslog-ng/.
17
18 This manual page is only an abstract; for the complete documentation of
19 syslog-ng, see
20 The syslog-ng Administrator Guide [1].
21
22 The syslog-ng application is a flexible and highly scalable system
23 logging application. Typically, syslog-ng is used to manage log
24 messages and implement centralized logging, where the aim is to collect
25 the log messages of several devices on a single, central log server.
26 The different devices - called syslog-ng clients - all run syslog-ng,
27 and collect the log messages from the various applications, files, and
28 other sources. The clients send all important log messages to the
29 remote syslog-ng server, where the server sorts and stores them.
30
31 The syslog-ng application reads incoming messages and forwards them to
32 the selected destinations. The syslog-ng application can receive
33 messages from files, remote hosts, and other sources.
34
35 Log messages enter syslog-ng in one of the defined sources, and are
36 sent to one or more destinations.
37
38 Sources and destinations are independent objects; log paths define what
39 syslog-ng does with a message, connecting the sources to the
40 destinations. A log path consists of one or more sources and one or
41 more destinations; messages arriving to a source are sent to every
42 destination listed in the log path. A log path defined in syslog-ng is
43 called a log statement.
44
45 Optionally, log paths can include filters. Filters are rules that
46 select only certain messages, for example, selecting only messages sent
47 by a specific application. If a log path includes filters, syslog-ng
48 sends only the messages satisfying the filter rules to the destinations
49 set in the log path.
50
52 Global objects (e.g., sources, destinations, log paths, or filters) are
53 defined in the syslog-ng configuration file. Object definitions consist
54 of the following elements:
55
56 · Type of the object: One of source, destination, log, filter,
57 parser, rewrite rule, or template.
58
59 · Identifier of the object: A unique name identifying the object.
60 When using a reserved word as an identifier, enclose the identifier
61 in quotation marks.
62
63 Tip
64 Use identifiers that refer to the type of the object they identify.
65 For example, prefix source objects with s_, destinations with d_,
66 and so on.
67
68 · Parameters: The parameters of the object, enclosed in braces
69 {parameters}.
70
71 · Semicolon: Object definitions end with a semicolon (;).
72
73 The syntax is summarized as follows:
74
75 The syntax of log statements is as follows:
76
77 log {
78 source(s1); source(s2); ...
79 optional_element(filter1|parser1|rewrite1); optional_element(filter2|parser2|rewrite2);...
80 destination(d1); destination(d2); ...
81 flags(flag1[, flag2...]);
82 };
83
84 The following log statement sends all messages arriving to the
85 localhost to a remote server.
86
87 source s_localhost { tcp(ip(127.0.0.1) port(1999) ); };
88 destination d_tcp { tcp("10.1.2.3" port(1999); localport(999)); };
89 log { source(s_localhost); destination(d_tcp); };
90
91 The syslog-ng application has a number of global options governing DNS
92 usage, the timestamp format used, and other general points. Each option
93 may have parameters, similarly to driver specifications. To set global
94 options, add an option statement to the syslog-ng configuration file
95 using the following syntax:
96
97 options { option1(params); option2(params); ... };
98
99 The sources, destinations, and filters available in syslog-ng are
100 listed below. For details, see
101 The syslog-ng Administrator Guide [1].
102
103 Table 1. Source drivers available in syslog-ng
104 ┌──────────────────────────────────────────────┬────────────────────────────────────────────┐
105 │Name │ Description │
106 ├──────────────────────────────────────────────┼────────────────────────────────────────────┤
107 │internal() │ Messages generated │
108 │ │ internally in syslog-ng. │
109 ├──────────────────────────────────────────────┼────────────────────────────────────────────┤
110 │file() │ Opens the specified file │
111 │ │ and reads messages. │
112 ├──────────────────────────────────────────────┼────────────────────────────────────────────┤
113 │pipe(), fifo │ Opens the specified named │
114 │ │ pipe and reads messages. │
115 ├──────────────────────────────────────────────┼────────────────────────────────────────────┤
116 │program() │ Opens the specified │
117 │ │ application and reads │
118 │ │ messages from its standard │
119 │ │ output. │
120 ├──────────────────────────────────────────────┼────────────────────────────────────────────┤
121 │sun-stream(), │ Opens the specified STREAMS device │
122 │ sun-streams() │ on Solaris │
123 │ │ systems │
124 │ │ and reads incoming messages. │
125 ├──────────────────────────────────────────────┼────────────────────────────────────────────┤
126 │syslog() │ Listens for incoming messages using │
127 │ │ the new IETF-standard syslog │
128 │ │ protocol. │
129 ├──────────────────────────────────────────────┼────────────────────────────────────────────┤
130 │tcp(), tcp6() │ Listens on the specified TCP port for │
131 │ │ incoming messages using the │
132 │ │ BSD-syslog │
133 │ │ protocol │
134 │ │ over IPv4 and IPv6 networks, │
135 │ │ respectively. │
136 ├──────────────────────────────────────────────┼────────────────────────────────────────────┤
137 │udp(), udp6() │ Listens on the specified UDP port for │
138 │ │ incoming messages using the │
139 │ │ BSD-syslog │
140 │ │ protocol over │
141 │ │ IPv4 and IPv6 networks, respectively. │
142 ├──────────────────────────────────────────────┼────────────────────────────────────────────┤
143 │unix-dgram() │ Opens the specified unix socket in │
144 │ │ SOCK_DGRAM │
145 │ │ mode and │
146 │ │ listens for incoming messages. │
147 ├──────────────────────────────────────────────┼────────────────────────────────────────────┤
148 │unix-stream() │ Opens the specified unix socket in │
149 │ │ SOCK_STREAM │
150 │ │ mode and │
151 │ │ listens for incoming messages. │
152 └──────────────────────────────────────────────┴────────────────────────────────────────────┘
153 Table 2. Destination drivers available in syslog-ng
154
155 ┌─────────────────┬────────────────────────────────────────────┐
156 │Name │ Description │
157 ├─────────────────┼────────────────────────────────────────────┤
158 │file() │ Writes messages to the │
159 │ │ specified file. │
160 ├─────────────────┼────────────────────────────────────────────┤
161 │logstore()* │ Writes messages to the │
162 │ │ specified binary logstore │
163 │ │ file. │
164 │ │ *Available │
165 │ │ only in syslog-ng Premium │
166 │ │ Edition. │
167 ├─────────────────┼────────────────────────────────────────────┤
168 │fifo(), pipe() │ Writes messages to the specified named │
169 │ │ pipe. │
170 ├─────────────────┼────────────────────────────────────────────┤
171 │program() │ Forks and launches the specified │
172 │ │ program, and sends messages to its │
173 │ │ standard │
174 │ │ input. │
175 ├─────────────────┼────────────────────────────────────────────┤
176 │sql() │ Sends messages into an SQL database. │
177 │ │ In addition to the standard │
178 │ │ syslog-ng │
179 │ │ packages, the sql() destination │
180 │ │ requires │
181 │ │ database-specific packages to be │
182 │ │ installed. Refer to the │
183 │ │ section │
184 │ │ appropriate for your platform in ???. │
185 ├─────────────────┼────────────────────────────────────────────┤
186 │syslog() │ Sends messages to the specified remote │
187 │ │ host using the IETF-syslog protocol. │
188 │ │ The IETF │
189 │ │ standard supports message transport │
190 │ │ using the UDP, TCP, and TLS │
191 │ │ networking │
192 │ │ protocols. │
193 ├─────────────────┼────────────────────────────────────────────┤
194 │tcp() and tcp6() │ Sends messages to the specified TCP │
195 │ │ port of a remote host using the │
196 │ │ BSD-syslog │
197 │ │ protocol │
198 │ │ over IPv4 and IPv6, respectively. │
199 ├─────────────────┼────────────────────────────────────────────┤
200 │udp() and udp6() │ Sends messages to the specified UDP port │
201 │ │ of a remote host using the │
202 │ │ BSD-syslog │
203 │ │ protocol over │
204 │ │ IPv4 and IPv6, respectively. │
205 ├─────────────────┼────────────────────────────────────────────┤
206 │unix-dgram() │ Sends messages to the specified unix │
207 │ │ socket in │
208 │ │ SOCK_DGRAM │
209 │ │ style (BSD). │
210 ├─────────────────┼────────────────────────────────────────────┤
211 │unix-stream() │ Sends messages to the specified unix │
212 │ │ socket in │
213 │ │ SOCK_STREAM │
214 │ │ style (Linux). │
215 ├─────────────────┼────────────────────────────────────────────┤
216 │usertty() │ Sends messages to the terminal of the │
217 │ │ specified user, if the user is │
218 │ │ logged in. │
219 └─────────────────┴────────────────────────────────────────────┘
220 Table 3. Filter functions in syslog-ng
221 ┌───────────┬────────────────────────────────┬──────────────────────────────────────────────────────────────────────┐
222 │Name │ Synopsis │ Description │
223 ├───────────┼────────────────────────────────┼──────────────────────────────────────────────────────────────────────┤
224 │facility() │ facility(facility[,facility]) │ Match messages │
225 │ │ │ having one of the │
226 │ │ │ listed facility │
227 │ │ │ code. An alternate │
228 │ │ │ syntax │
229 │ │ │ permits the use an │
230 │ │ │ arbitrary facility │
231 │ │ │ codes. │
232 ├───────────┼────────────────────────────────┼──────────────────────────────────────────────────────────────────────┤
233 │facility() │ facility(<numeric facility │ An alternate syntax for facility │
234 │ │ code>) │ permitting │
235 │ │ │ the │
236 │ │ │ use of an arbitrary facility code. │
237 │ │ │ Facility codes 0-23 are │
238 │ │ │ predefined │
239 │ │ │ and can be referenced by their │
240 │ │ │ usual name. Facility codes │
241 │ │ │ above │
242 │ │ │ 24 are not defined but can be used │
243 │ │ │ by this alternate syntax. │
244 ├───────────┼────────────────────────────────┼──────────────────────────────────────────────────────────────────────┤
245 │filter() │ filter(filtername) │ Call another filter rule and evaluate │
246 │ │ │ its value. │
247 ├───────────┼────────────────────────────────┼──────────────────────────────────────────────────────────────────────┤
248 │host() │ host(regexp) │ Match messages by using a regular │
249 │ │ │ expression against the hostname │
250 │ │ │ field of │
251 │ │ │ log messages. │
252 ├───────────┼────────────────────────────────┼──────────────────────────────────────────────────────────────────────┤
253 │level() or │ level(pri[,pri1..pri2[,pri3]]) │ Match messages based on priority. │
254 │priority() │ │ │
255 ├───────────┼────────────────────────────────┼──────────────────────────────────────────────────────────────────────┤
256 │match() │ match(regexp) │ Match a regular expression to the │
257 │ │ │ headers and the message itself │
258 │ │ │ (i.e., the │
259 │ │ │ values returned by the MSGHDR and │
260 │ │ │ MSG │
261 │ │ │ macros). Note that in syslog-ng │
262 │ │ │ version │
263 │ │ │ 2.1 and │
264 │ │ │ earlier, the match() filter was │
265 │ │ │ applied │
266 │ │ │ only to │
267 │ │ │ the text of the message, excluding the │
268 │ │ │ headers. This │
269 │ │ │ functionality │
270 │ │ │ has been moved to the message() │
271 │ │ │ filter. To │
272 │ │ │ limit the scope of the match to a │
273 │ │ │ specific part of the │
274 │ │ │ message │
275 │ │ │ (identified with a macro), use the │
276 │ │ │ match(regexp │
277 │ │ │ value("$MACRO")) │
278 │ │ │ syntax. │
279 ├───────────┼────────────────────────────────┼──────────────────────────────────────────────────────────────────────┤
280 │message() │ message(regexp) │ Match a regular expression to the text of the │
281 │ │ │ log message, excluding │
282 │ │ │ the headers (i.e., │
283 │ │ │ the value returned by the MSG │
284 │ │ │ macros). Note that │
285 │ │ │ in syslog-ng version 2.1 and earlier, this │
286 │ │ │ functionality was │
287 │ │ │ performed by the match() │
288 │ │ │ filter. │
289 ├───────────┼────────────────────────────────┼──────────────────────────────────────────────────────────────────────┤
290 │netmask() │ netmask(ip/mask) │ Select only messages sent by a host whose IP │
291 │ │ │ address belongs to the │
292 │ │ │ specified IP subnet. │
293 │ │ │ Note that this filter checks the IP address of │
294 │ │ │ the │
295 │ │ │ last-hop relay (the │
296 │ │ │ host that actually sent the message to │
297 │ │ │ syslog-ng), │
298 │ │ │ not the contents of │
299 │ │ │ the HOST field of the │
300 │ │ │ message. │
301 ├───────────┼────────────────────────────────┼──────────────────────────────────────────────────────────────────────┤
302 │program() │ program(regexp) │ Match messages by using a regular expression │
303 │ │ │ against the program name │
304 │ │ │ field of log │
305 │ │ │ messages. │
306 ├───────────┼────────────────────────────────┼──────────────────────────────────────────────────────────────────────┤
307 │source() │ string │ Select messages of a source statement. This │
308 │ │ │ filter can be used in │
309 │ │ │ embedded log │
310 │ │ │ statements if the parent statement contains │
311 │ │ │ multiple source │
312 │ │ │ groups — only │
313 │ │ │ messages originating from the selected source │
314 │ │ │ group are sent to │
315 │ │ │ the destination of the embedded log statement. │
316 ├───────────┼────────────────────────────────┼──────────────────────────────────────────────────────────────────────┤
317 │tags() │ tag │ Select messages labeled with the specified tag. │
318 │ │ │ Every message │
319 │ │ │ automatically has │
320 │ │ │ the tag of its source in │
321 │ │ │ .source.<id_of_the_source_statement> │
322 │ │ │ format. This option │
323 │ │ │ is available only in syslog-ng 3.1 and later. │
324 └───────────┴────────────────────────────────┴──────────────────────────────────────────────────────────────────────┘
325
327 /opt/syslog-ng/etc/syslog-ng/
328
329 /opt/syslog-ng/etc/syslog-ng/syslog-ng.conf
330
332 syslog-ng(8)
333
334 The syslog-ng Administrator Guide [1]
335
336 If you experience any problems or need help with syslog-ng, visit the
337 syslog-ng mailing list [2]
338
339 For news and notifications about the documentation of syslog-ng, visit
340 the BalaBit Documentation Blog[3].
341
343 This manual page was written by the BalaBit Documentation Team
344 <documentation@balabit.com>.
345
347 Copyright © 2000-2009 BalaBit IT Security Ltd. Published under the
348 Creative Commons Attribution-Noncommercial-No Derivative Works
349 (by-nc-nd) 3.0 license. See http://creativecommons.org/ for details.
350 The latest version is always available at
351 http://www.balabit.com/support/documentation.
352
354 1.
355
356 The syslog-ng Administrator Guide
357
358 http://www.balabit.com/support/documentation/
359
360 2.
361
362 syslog-ng mailing list
363
364 https://lists.balabit.hu/mailman/listinfo/syslog-ng
365
366 3. BalaBit Documentation Blog
367 http://robert.blogs.balabit.com
368
369
370
371 11/30/2009 SYSLOG-NG.CONF(5)