1SYSLOG-NG.CONF(5)       The syslog-ng.conf manual page       SYSLOG-NG.CONF(5)
2
3
4

NAME

6       syslog-ng.conf - syslog-ng configuration file
7

SYNOPSIS

9       syslog-ng.conf
10

DESCRIPTION

12       This manual page is only an abstract, for the complete documentation of
13       syslog-ng, see The Administrator Guide[1] or the official syslog-ng
14       website[2].
15
16       The application is a flexible and highly scalable system logging
17       application. Typically, syslog-ng is used to manage log messages and
18       implement centralized logging, where the aim is to collect the log
19       messages of several devices on a single, central log server. The
20       different devices - called syslog-ng clients - all run syslog-ng, and
21       collect the log messages from the various applications, files, and
22       other sources. The clients send all important log messages to the
23       remote syslog-ng server, where the server sorts and stores them.
24

BASIC CONCEPTS OF

26       The syslog-ng application reads incoming messages and forwards them to
27       the selected destinations. The syslog-ng application can receive
28       messages from files, remote hosts, and other sources.
29
30       Log messages enter syslog-ng in one of the defined sources, and are
31       sent to one or more destinations.
32
33       Sources and destinations are independent objects, log paths define what
34       syslog-ng does with a message, connecting the sources to the
35       destinations. A log path consists of one or more sources and one or
36       more destinations: messages arriving from a source are sent to every
37       destination listed in the log path. A log path defined in syslog-ng is
38       called a log statement.
39
40       Optionally, log paths can include filters. Filters are rules that
41       select only certain messages, for example, selecting only messages sent
42       by a specific application. If a log path includes filters, syslog-ng
43       sends only the messages satisfying the filter rules to the destinations
44       set in the log path.
45
46       Other optional elements that can appear in log statements are parsers
47       and rewriting rules. Parsers segment messages into different fields to
48       help processing the messages, while rewrite rules modify the messages
49       by adding, replacing, or removing parts of the messages.
50

CONFIGURING SYSLOG-NG

52       •   The main body of the configuration file consists of object
53           definitions: sources, destinations, logpaths define which log
54           message are received and where they are sent. All identifiers,
55           option names and attributes, and any other strings used in the
56           syslog-ng configuration file are case sensitive. Object definitions
57           (also called statements) have the following syntax:
58
59               type-of-the-object identifier-of-the-object {<parameters>};
60
61Type of the object: One of source, destination, log, filter,
62               parser, rewrite rule, or template.
63
64Identifier of the object: A unique name identifying the object.
65               When using a reserved word as an identifier, enclose the
66               identifier in quotation marks.
67
68               All identifiers, attributes, and any other strings used in the
69               syslog-ng configuration file are case sensitive.
70
71                   Tip
72                   Use identifiers that refer to the type of the object they
73                   identify. For example, prefix source objects with s_,
74                   destinations with d_, and so on.
75
76                   Note
77                   Repeating a definition of an object (that is, defining the
78                   same object with the same id more than once) is not
79                   allowed, unless you use the @define allow-config-dups 1
80                   definition in the configuration file.
81
82Parameters: The parameters of the object, enclosed in braces
83               {parameters}.
84
85Semicolon: Object definitions end with a semicolon (;).
86
87           For example, the following line defines a source and calls it
88           s_internal.
89
90               source s_internal { internal(); };
91
92           The object can be later referenced in other statements using its
93           ID, for example, the previous source is used as a parameter of the
94           following log statement:
95
96               log { source(s_internal); destination(d_file); };
97
98       •   The parameters and options within a statement are similar to
99           function calls of the C programming language: the name of the
100           option followed by a list of its parameters enclosed within
101           brackets and terminated with a semicolon.
102
103               option(parameter1, parameter2); option2(parameter1, parameter2);
104
105           For example, the file() driver in the following source statement
106           has three options: the filename (/var/log/apache/access.log),
107           follow-freq(), and flags(). The follow-freq() option also has a
108           parameter, while the flags() option has two parameters.
109
110               source s_tail { file("/var/log/apache/access.log"
111                   follow-freq(1) flags(no-parse, validate-utf8)); };
112
113           Objects may have required and optional parameters. Required
114           parameters are positional, meaning that they must be specified in a
115           defined order. Optional parameters can be specified in any order
116           using the option(value) format. If a parameter (optional or
117           required) is not specified, its default value is used. The
118           parameters and their default values are listed in the reference
119           section of the particular object.
120
121           Example 1. Using required and optional parameters The unix-stream()
122           source driver has a single required argument: the name of the
123           socket to listen on. Optional parameters follow the socket name in
124           any order, so the following source definitions have the same
125           effect:
126
127               source s_demo_stream1 {
128                       unix-stream("<path-to-socket>" max-connections(10) group(log)); };
129               source s_demo_stream2 {
130                       unix-stream("<path-to-socket>" group(log) max-connections(10)); };
131
132       •   Some options are global options, or can be set globally, for
133           example, whether should use DNS resolution to resolve IP addresses.
134           Global options are detailed in ???.
135
136               options { use-dns(no); };
137
138       •   Objects can be used before definition.
139
140       •   Objects can be defined inline as well. This is useful if you use
141           the object only once (for example, a filter). For details, see ???.
142
143       •   To add comments to the configuration file, start a line with # and
144           write your comments. These lines are ignored by syslog-ng.
145
146               # Comment: This is a stream source
147               source s_demo_stream {
148                       unix-stream("<path-to-socket>" max-connections(10) group(log)); };
149
150       The syntax of log statements is as follows:
151
152           log {
153               source(s1); source(s2); ...
154               optional_element(filter1|parser1|rewrite1);
155               optional_element(filter2|parser2|rewrite2);
156               ...
157               destination(d1); destination(d2); ...
158               flags(flag1[, flag2...]);
159           };
160
161       The following log statement sends all messages arriving to the
162       localhost to a remote server.
163
164           source s_localhost { network(ip(127.0.0.1) port(1999)); };
165           destination d_tcp { network("10.1.2.3" port(1999) localport(999)); };
166           log { source(s_localhost); destination(d_tcp); };
167
168       The syslog-ng application has a number of global options governing DNS
169       usage, the timestamp format used, and other general points. Each option
170       may have parameters, similarly to driver specifications. To set global
171       options, add an option statement to the syslog-ng configuration file
172       using the following syntax:
173
174           options { option1(params); option2(params); ... };
175
176       Example 2. Using global options
177
178       To disable domain name resolving, add the following line to the
179       syslog-ng configuration file:
180
181           options { use-dns(no); };
182
183       The sources, destinations, and filters available in syslog-ng are
184       listed below. For details, see The syslog-ng Administrator Guide.
185
186       Table 1. Source drivers available in syslog-ng
187       ┌──────────────────┬────────────────────────────┐
188Name              Description                
189       ├──────────────────┼────────────────────────────┤
190       │file()            │ Opens the specified file   │
191       │                  │ and reads messages.        │
192       ├──────────────────┼────────────────────────────┤
193       │internal()        │ Messages generated         │
194       │                  │ internally in syslog-ng.   │
195       ├──────────────────┼────────────────────────────┤
196       │network()         │ Receives messages from     │
197       │                  │ remote hosts using the     │
198       │                  │ BSD-syslog protocol over   │
199       │                  │ IPv4 and IPv6. Supports    │
200       │                  │ the TCP, UDP, and TLS      │
201       │                  │ network protocols.         │
202       ├──────────────────┼────────────────────────────┤
203       │pipe()            │ Opens the specified named  │
204       │                  │ pipe and reads messages.   │
205       ├──────────────────┼────────────────────────────┤
206       │program()         │ Opens the specified        │
207       │                  │ application and reads      │
208       │                  │ messages from its standard │
209       │                  │ output.                    │
210       ├──────────────────┼────────────────────────────┤
211       │sun-stream(),     │ Opens the specified        │
212       │sun-streams()     │ STREAMS device on Solaris  │
213       │                  │ systems and reads incoming │
214       │                  │ messages.                  │
215       ├──────────────────┼────────────────────────────┤
216       │syslog()          │ Listens for incoming       │
217       │                  │ messages using the new     │
218       │                  │ IETF-standard syslog       │
219       │                  │ protocol.                  │
220       ├──────────────────┼────────────────────────────┤
221       │system()          │ Automatically detects      │
222       │                  │ which platform  is running │
223       │                  │ on, and collects the       │
224       │                  │ native log messages of     │
225       │                  │ that platform.             │
226       ├──────────────────┼────────────────────────────┤
227       │systemd-journal() │ Collects messages directly │
228       │                  │ from the journal of        │
229       │                  │ platforms that use         │
230       │                  │ systemd.                   │
231       ├──────────────────┼────────────────────────────┤
232       │systemd-syslog()  │ Collects messages from the │
233       │                  │ journal using a socket on  │
234       │                  │ platforms that use         │
235       │                  │ systemd.                   │
236       ├──────────────────┼────────────────────────────┤
237       │unix-dgram()      │ Opens the specified unix   │
238       │                  │ socket in SOCK_DGRAM mode  │
239       │                  │ and listens for incoming   │
240       │                  │ messages.                  │
241       ├──────────────────┼────────────────────────────┤
242       │unix-stream()     │ Opens the specified unix   │
243       │                  │ socket in SOCK_STREAM mode │
244       │                  │ and listens for incoming   │
245       │                  │ messages.                  │
246       └──────────────────┴────────────────────────────┘
247
248       Table 2. Destination drivers available in syslog-ng
249       ┌───────────────┬────────────────────────────┐
250Name           Description                
251       ├───────────────┼────────────────────────────┤
252       │elasticsearch2 │ Sends messages to an       │
253       │               │ Elasticsearch server. The  │
254       │               │ elasticsearch2 driver      │
255       │               │ supports Elasticsearch     │
256       │               │ version 2 and newer.       │
257       ├───────────────┼────────────────────────────┤
258       │file()         │ Writes messages to the     │
259       │               │ specified file.            │
260       ├───────────────┼────────────────────────────┤
261       │hdfs()         │ Sends messages into a file │
262       │               │ on a Hadoop Distributed    
263       │               │ File System (HDFS)[3]      │
264       │               │ node.                      │
265       ├───────────────┼────────────────────────────┤
266       │kafka()        │ Publishes log messages to  │
267       │               │ the Apache Kafka[4]        │
268       │               │ message bus, where         │
269       │               │ subscribers can access     │
270       │               │ them.                      │
271       ├───────────────┼────────────────────────────┤
272       │loggly()       │ Sends log messages to the  │
273       │               │ Loggly[5]                  │
274       │               │ Logging-as-a-Service       │
275       │               │ provider.                  │
276       ├───────────────┼────────────────────────────┤
277       │logmatic()     │ Sends log messages to the  │
278       │               │ Logmatic.io[6]             │
279       │               │ Logging-as-a-Service       │
280       │               │ provider.                  │
281       ├───────────────┼────────────────────────────┤
282       │mongodb()      │ Sends messages to a        │
283       │               │ MongoDB[7] database.       │
284       ├───────────────┼────────────────────────────┤
285       │network()      │ Sends messages to a remote │
286       │               │ host using the BSD-syslog  │
287       │               │ protocol over IPv4 and     │
288       │               │ IPv6. Supports the TCP,    │
289       │               │ UDP, and TLS network       │
290       │               │ protocols.                 │
291       ├───────────────┼────────────────────────────┤
292       │pipe()         │ Writes messages to the     │
293       │               │ specified named pipe.      │
294       ├───────────────┼────────────────────────────┤
295       │program()      │ Forks and launches the     │
296       │               │ specified program, and     │
297       │               │ sends messages to its      │
298       │               │ standard input.            │
299       ├───────────────┼────────────────────────────┤
300       │sql()          │ Sends messages into an SQL │
301       │               │ database. In addition to   │
302       │               │ the standard syslog-ng     │
303       │               │ packages, the sql()
304       │               │ destination requires       │
305       │               │ database-specific packages │
306       │               │ to be installed. Refer to  │
307       │               │ the section appropriate    │
308       │               │ for your platform in ???.  │
309       ├───────────────┼────────────────────────────┤
310       │syslog()       │ Sends messages to the      │
311       │               │ specified remote host      │
312       │               │ using the IETF-syslog      │
313       │               │ protocol. The IETF         │
314       │               │ standard supports message  │
315       │               │ transport using the UDP,   │
316       │               │ TCP, and TLS networking    │
317       │               │ protocols.                 │
318       ├───────────────┼────────────────────────────┤
319       │unix-dgram()   │ Sends messages to the      │
320       │               │ specified unix socket in   │
321       │               │ SOCK_DGRAM style (BSD).    │
322       ├───────────────┼────────────────────────────┤
323       │unix-stream()  │ Sends messages to the      │
324       │               │ specified unix socket in   │
325       │               │ SOCK_STREAM style (Linux). │
326       ├───────────────┼────────────────────────────┤
327       │usertty()      │ Sends messages to the      │
328       │               │ terminal of the specified  │
329       │               │ user, if the user is       │
330       │               │ logged in.                 │
331       └───────────────┴────────────────────────────┘
332
333       Table 3. Filter functions available in
334       ┌──────────────────────┬────────────────────────────┐
335Name                  Description                
336       ├──────────────────────┼────────────────────────────┤
337       │facility()            │ Filter messages based on   │
338       │                      │ the sending facility.      │
339       ├──────────────────────┼────────────────────────────┤
340       │filter()              │ Call another filter        │
341       │                      │ function.                  │
342       ├──────────────────────┼────────────────────────────┤
343       │host()                │ Filter messages based on   │
344       │                      │ the sending host.          │
345       ├──────────────────────┼────────────────────────────┤
346       │inlist()              │ File-based whitelisting    │
347       │                      │ and blacklisting.          │
348       ├──────────────────────┼────────────────────────────┤
349       │level() or priority() │ Filter messages based on   │
350       │                      │ their priority.            │
351       ├──────────────────────┼────────────────────────────┤
352       │match()               │ Use a regular expression   │
353       │                      │ to filter messages based   │
354       │                      │ on a specified header or   │
355       │                      │ content field.             │
356       ├──────────────────────┼────────────────────────────┤
357       │message()             │ Use a regular expression   │
358       │                      │ to filter messages based   │
359       │                      │ on their content.          │
360       ├──────────────────────┼────────────────────────────┤
361       │netmask()             │ Filter messages based on   │
362       │                      │ the IP address of the      │
363       │                      │ sending host.              │
364       ├──────────────────────┼────────────────────────────┤
365       │program()             │ Filter messages based on   │
366       │                      │ the sending application.   │
367       ├──────────────────────┼────────────────────────────┤
368       │source()              │ Select messages of the     │
369       │                      │ specified  source          │
370       │                      │ statement.                 │
371       ├──────────────────────┼────────────────────────────┤
372       │tags()                │ Select messages having the │
373       │                      │ specified tag.             │
374       └──────────────────────┴────────────────────────────┘
375

FILES

377       /usr/local/
378
379       /usr/local/etc/syslog-ng.conf
380

SEE ALSO

382       syslog-ng(8)
383
384           Note
385           For the detailed documentation of see The 3.33 Administrator
386           Guide[8]
387
388           If you experience any problems or need help with syslog-ng, visit
389           the syslog-ng mailing list[9].
390
391           For news and notifications about of syslog-ng, visit the syslog-ng
392           blogs[10].
393

AUTHOR

395       This manual page was written by the Balabit Documentation Team
396       <documentation@balabit.com>.
397

NOTES

400        1. The  Administrator Guide
401           https://www.balabit.com/support/documentation/
402
403        2. the official syslog-ng website
404           https://www.balabit.com/log-management
405
406        3. Hadoop Distributed File System (HDFS)
407           http://hadoop.apache.org/
408
409        4. Apache Kafka
410           http://kafka.apache.org
411
412        5. Loggly
413           https://www.loggly.com/
414
415        6. Logmatic.io
416           https://logmatic.io/
417
418        7. MongoDB
419           https://www.mongodb.com
420
421        8. The  3.33 Administrator Guide
422           https://www.balabit.com/documents/syslog-ng-ose-latest-guides/en/syslog-ng-ose-guide-admin/html/index.html
423
424        9. syslog-ng mailing list
425           https://lists.balabit.hu/mailman/listinfo/syslog-ng
426
427       10. syslog-ng blogs
428           https://syslog-ng.org/blogs/
429
430
431
4323.33                              07/19/2021                 SYSLOG-NG.CONF(5)
Impressum