Destination drivers output log messages to somewhere outside syslog-ng e.g., to a file or a network socket.
The file driver outputs messages to the specified text file, or to a set of files.
The destination filename may include macros which get expanded when the message is
written, thus a simple file() driver may create several
files. For more information on available macros see Section 8.5, “Macros”.
![]() |
Warning |
|---|---|
|
When creating several thousands separate log files, syslog-ng might not be able to
open the required number of files. This might happen for example when using the
|
The file() destination has the following options:
| Name | Type | Default | Description |
|---|---|---|---|
| create_dirs() | yes or no | no | Enable creating non-existing directories. |
| dir_group() | string | root | The group of directories created by syslog-ng. |
| dir_owner() | string | root | The owner of directories created by syslog-ng. |
| dir_perm() | number | 0600 | The permission mask of directories created by syslog-ng. Log
directories are only created if a file after macro expansion refers
to a non-existing directory, and directory creation is enabled (see
the create_dirs() option below). For octal
numbers prefix the number with 0, e.g., use
0755 for
rwxr-xr-x. |
| flags() | no_multi_line, syslog-protocol | empty set |
Flags influence the behavior of the driver. The The |
| flush_lines() | number | Use global setting. | Specifies how many lines are flushed to a destination at a time.
Syslog-ng waits for this number of lines to accumulate and sends them off in
a single batch. Setting this number high increases throughput as fully
filled frames are sent to the network, but also increases message latency.
The latency can be limited by the use of the
flush_timeout option. |
| flush_timeout() | time in milliseconds | Use global setting. | Specifies the time syslog-ng waits for lines to accumulate in its output
buffer. See the flush_lines option for more
information. |
| frac_digits() | number | 0 | The syslog-ng application can store fractions of a second in the
timestamps according to the ISO8601 format.. The
frac_digits() parameter specifies the number of
digits stored. The digits storing the fractions are padded by zeros if the
original timestamp of the message specifies only seconds. Fractions can
always be stored for the time the message was received. Note that syslog-ng
can add the fractions to non-ISO8601 timestamps as well. |
| fsync() | yes or no | no | Forces an fsync() call on the destination fd after
each write. Note: enabling this option may seriously degrade
performance. |
| group() | string | root | Set the group of the created file to the one specified. |
local_time_zone()
|
name of the timezone or the timezone offset | The local timezone. | Sets the timezone used when expanding filename and tablename templates.
The timezone can be specified as using the name of the (e.g.,
time_zone("Europe/Budapest")), or as the timezone
offset (e.g., +01:00). The valid timezone names are
listed under the /usr/share/zoneinfo directory. |
| log_fifo_size() | number | Use global setting. | The number of entries in the output buffer (output fifo). |
overwrite_if_older()
|
number | 0 | If set to a value higher than 0, syslog-ng checks when the file
was last modified before starting to write into the file. If the
file is older than the specified amount of time (in seconds), then
syslog-ng removes the existing file and opens a new file with the
same name. In combination with e.g., the
$WEEKDAY macro, this can be used for simple
log rotation, in case not all history has to be kept. (Note that in
this weekly log rotation example if its Monday 00:01, then the file
from last Monday is not seven days old, because it was probably last
modified shortly before 23:59 last Monday, so it is actually not
even six days old. So in this case, set the
overwrite_if_older() parameter to
a-bit-less-than-six-days, for example, to
518000 seconds. |
| owner() | string | root | Set the owner of the created file to the one specified. |
| perm() | number | 0600 | The permission mask of the file if it is created by syslog-ng.
For octal numbers prefix the number with 0,
e.g., use 0755 for
rwxr-xr-x. |
| suppress() | seconds | 0 (disabled) | If several identical log messages would be sent to the destination
without any other messages between the identical messages (for example, an
application repeated an error message ten times), syslog-ng can suppress the
repeated messages and send the message only once, followed by the
Last message repeated n times. message. The
parameter of this option specifies the number of seconds syslog-ng waits for
identical messages. |
| template() | string | A format conforming to the default logfile format. | Specifies a template defining the logformat to be used in the
destination. Macros are described in Section 8.5, “Macros”.
Please note that for network destinations it might not be appropriate to
change the template as it changes the on-wire format of the syslog protocol
which might not be tolerated by stock syslog receivers (like
syslogd or syslog-ng itself). For network
destinations make sure the receiver can cope with the custom format defined.
|
| template_escape() | yes or no | no | Turns on escaping ' and "
in templated output files. This is useful for generating SQL statements and
quoting string contents so that parts of the log message are not interpreted
as commands to the SQL server. |
| throttle() | number | 0 | Sets the maximum number of messages sent to the destination per second.
Use this output-rate-limiting functionality only when using disk-buffer as
well to avoid the risk of losing messages. Specifying
0 or a lower value sets the output limit to
unlimited. |
| time_zone() | timezone offset in seconds | unspecified | Convert timestamps to the timezone specified by this option. If this option is not set then the original timezone information in the message is used. |
| ts_format() | rfc3164, bsd, rfc3339, iso | rfc3164 | Override the global timestamp format (set in the global
ts_format() parameter) for the specific
destination. See also Section 7.7, “A note on timezones and timestamps”. |
Table 8.8. Options for file()
The logstore driver stores log messages in binary files that can be encrypted,
compressed, checked for integrity, and timestamped by an external Timestamping
Authority (TSA). Otherwise, it is very similar to the
file()
destination.
To display the contents of a logstore file, use the logcat command supplied with syslog-ng, e.g., logcat /var/log/messages.lgs.
The destination filename may include macros which get expanded when the message is
written, thus a simple logstore() driver may create several
files. For more information on available macros see Section 8.5, “Macros”.
![]() |
Warning |
|---|---|
|
When creating several thousands separate log files, syslog-ng might not be able to
open the required number of files. This might happen for example when using the
|
The logstore() has a single required parameter that
specifies the filename that stores the log messages.
Declaration:
logstore(filename options());
The logstore() destination has the following options:
| Name | Type | Default | Description |
|---|---|---|---|
| chunk_size() | number | 128 | Size of a logstore chunk in kilobytes. Note that this size refers
to the compressed size of the chunk. Also, the gzip library used for
compressing the messages has a 32k long buffer; messages may not
appear in the actual logfile until this buffer is not filled.
Logstore chunks are closed when they reach the specified size, or
when the time limit set in chunk_time
expires. |
| chunk_time() | number | 5 | Time limit in seconds: syslog-ng PE closes the chunk if no new
messages arrive until the time limit expires. Logstore chunks are
closed when the time limit expires, or when they reach the size
specified in the chunk_size parameter. If the
time limit set in the time_reap parameter
expires, the entire file is closed. |
| compress() | number between 0-9 | 3 | Compression level. 0 means uncompressed
files, while 1-9 is the compression level used by gzip
(9 means the highest but slowest compression,
3 is usually a good compromise). |
| create_dirs() | yes or no | no | Enable creating non-existing directories. |
| dir_group() | string | root | The group of the directories created by syslog-ng. |
| dir_owner() | string | root | The owner of directories created by syslog-ng. |
| dir_perm() | number | 0600 | The permission mask of directories created by syslog-ng. Log
directories are only created if a file after macro expansion refers
to a non-existing directory, and directory creation is enabled (see
the create_dirs() option below). For octal
numbers prefix the number with 0, e.g., use
0755 for
rwxr-xr-x. |
| encrypt_certificate() | filename | none | Name of a file, that contains an X.509 certificate (and the public key) in PEM format. The syslog-ng application uses this certificate to encrypt the logstore files which can be decrypted using the private key of the certificate. |
| flags() | no_multi_line, syslog-protocol | empty set |
Flags influence the behavior of the driver. The The |
| flush_lines() | number | Use global setting. | Specifies how many lines are flushed to a destination at a time.
Syslog-ng waits for this number of lines to accumulate and sends them off in
a single batch. Setting this number high increases throughput as fully
filled frames are sent to the network, but also increases message latency.
The latency can be limited by the use of the
flush_timeout option. |
| flush_timeout() | time in milliseconds | Use global setting. | Specifies the time syslog-ng waits for lines to accumulate in its output
buffer. See the flush_lines option for more
information. |
| frac_digits() | number | 0 | The syslog-ng application can store fractions of a second in the
timestamps according to the ISO8601 format.. The
frac_digits() parameter specifies the number of
digits stored. The digits storing the fractions are padded by zeros if the
original timestamp of the message specifies only seconds. Fractions can
always be stored for the time the message was received. Note that syslog-ng
can add the fractions to non-ISO8601 timestamps as well. |
| fsync() | yes or no | no | Forces an fsync() call on the destination fd after
each write. Note: enabling this option may seriously degrade
performance. |
| group() | string | root | Set the group of the created file to the one specified. |
| log_fifo_size() | number | Use global setting. | The number of entries in the output buffer (output fifo). |
| owner() | string | root | Set the owner of the created file to the one specified. |
| perm() | number | 0600 | The permission mask of the file if it is created by syslog-ng.
For octal numbers prefix the number with 0,
e.g., use 0755 for
rwxr-xr-x. |
| suppress() | seconds | 0 (disabled) | If several identical log messages would be sent to the destination
without any other messages between the identical messages (for example, an
application repeated an error message ten times), syslog-ng can suppress the
repeated messages and send the message only once, followed by the
Last message repeated n times. message. The
parameter of this option specifies the number of seconds syslog-ng waits for
identical messages. |
| template() | string | A format conforming to the default logfile format. | Specifies a template defining the logformat to be used in the
destination. Macros are described in Section 8.5, “Macros”.
Please note that for network destinations it might not be appropriate to
change the template as it changes the on-wire format of the syslog protocol
which might not be tolerated by stock syslog receivers (like
syslogd or syslog-ng itself). For network
destinations make sure the receiver can cope with the custom format defined.
|
| template_escape() | yes or no | no | Turns on escaping ' and "
in templated output files. This is useful for generating SQL statements and
quoting string contents so that parts of the log message are not interpreted
as commands to the SQL server. |
| throttle() | number | 0 | Sets the maximum number of messages sent to the destination per second.
Use this output-rate-limiting functionality only when using disk-buffer as
well to avoid the risk of losing messages. Specifying
0 or a lower value sets the output limit to
unlimited. |
| time_reap() | number | 60 | The time to wait in seconds before an idle destination file is closed. |
| timestamp-freq() | number in seconds | Use global setting. | The minimum time that should expire between two timestamping
requests. When syslog-ng closes a chunk, it checks how much time has
expired since the last timestamping request: if it is higher than
the value set in the timestamp-freq
parameter, it requests a new timestamp from the authority set in the
timestamp-url parameter. |
| timestamp-url() | string | Use global setting. | The URL of the Timestamping Authority used to request timestamps to sign logstore chunks. Note that syslog-ng currently supports only Timestamping Authorities that conform to RFC3161 Internet X.509 Public Key Infrastructure Time-Stamp Protocol, other protocols like Microsoft Authenticode Timestamping are not supported. |
| time_zone() | timezone offset in seconds | unspecified | Convert timestamps to the timezone specified by this option. If this option is not set then the original timezone information in the message is used. |
| ts_format() | rfc3164, bsd, rfc3339, iso | rfc3164 | Override the global timestamp format (set in the global
ts_format() parameter) for the specific
destination. See also Section 7.7, “A note on timezones and timestamps”. |
Table 8.9. Options for logstore()
This driver sends messages to a named pipe like
/dev/xconsole.
The pipe driver has a single required parameter, specifying the filename of the pipe to open. The filename can include macros.
Declaration:
pipe(filename);
![]() |
Warning |
|---|---|
As of syslog-ng Open Source Edition 3.0.2, pipes are created automatically. In earlier versions, you had to create the pipe using the mkfifo(1) command. |
The pipe() destination has the following options:
| Name | Type | Default | Description |
|---|---|---|---|
| flags() | no_multi_line, syslog-protocol | empty set |
Flags influence the behavior of the driver. The The |
| flush_lines() | number | Use global setting. | Specifies how many lines are flushed to a destination at a time.
Syslog-ng waits for this number of lines to accumulate and sends them off in
a single batch. Setting this number high increases throughput as fully
filled frames are sent to the network, but also increases message latency.
The latency can be limited by the use of the
flush_timeout option. |
| flush_timeout() | time in milliseconds | Use global setting. | Specifies the time syslog-ng waits for lines to accumulate in its output
buffer. See the flush_lines option for more
information. |
| frac_digits() | number | 0 | The syslog-ng application can store fractions of a second in the
timestamps according to the ISO8601 format.. The
frac_digits() parameter specifies the number of
digits stored. The digits storing the fractions are padded by zeros if the
original timestamp of the message specifies only seconds. Fractions can
always be stored for the time the message was received. Note that syslog-ng
can add the fractions to non-ISO8601 timestamps as well. |
| fsync() | yes or no | no | Forces an fsync() call on the destination fd after
each write. Note: enabling this option may seriously degrade
performance. |
| group() | string | root | Set the group of the pipe to the one specified. |
| log_fifo_size() | number | Use global setting. | The number of entries in the output buffer (output fifo). |
| owner() | string | root | Set the owner of the pipe to the one specified. |
| perm() | number | 0600 | The permission mask of the pipe. For octal numbers prefix the number with '0', e.g.: use 0755 for rwxr-xr-x. |
| suppress() | seconds | 0 (disabled) | If several identical log messages would be sent to the destination
without any other messages between the identical messages (for example, an
application repeated an error message ten times), syslog-ng can suppress the
repeated messages and send the message only once, followed by the
Last message repeated n times. message. The
parameter of this option specifies the number of seconds syslog-ng waits for
identical messages. |
| template() | string | A format conforming to the default logfile format. | Specifies a template defining the logformat to be used in the
destination. Macros are described in Section 8.5, “Macros”.
Please note that for network destinations it might not be appropriate to
change the template as it changes the on-wire format of the syslog protocol
which might not be tolerated by stock syslog receivers (like
syslogd or syslog-ng itself). For network
destinations make sure the receiver can cope with the custom format defined.
|
| template_escape() | yes or no | no | Turns on escaping ' and "
in templated output files. This is useful for generating SQL statements and
quoting string contents so that parts of the log message are not interpreted
as commands to the SQL server. |
| throttle() | number | 0 | Sets the maximum number of messages sent to the destination per second.
Use this output-rate-limiting functionality only when using disk-buffer as
well to avoid the risk of losing messages. Specifying
0 or a lower value sets the output limit to
unlimited. |
| time_zone() | timezone offset in seconds | unspecified | Convert timestamps to the timezone specified by this option. If this option is not set then the original timezone information in the message is used. |
| ts_format() | rfc3164, bsd, rfc3339, iso | rfc3164 | Override the global timestamp format (set in the global
ts_format() parameter) for the specific
destination. See also Section 7.7, “A note on timezones and timestamps”. |
Table 8.10. Options for pipe()
This driver starts an external application or script and sends the log messages to
its standard input (stdin).
The program() driver has a single required parameter,
specifying a program name to start.
Declaration:
program(command_to_run);
The program() destination has the following options:
| Name | Type | Default | Description |
|---|---|---|---|
| flags() | no_multi_line, syslog-protocol | empty set |
Flags influence the behavior of the driver. The The |
| flush_lines() | number | Use global setting. | Specifies how many lines are flushed to a destination at a time.
Syslog-ng waits for this number of lines to accumulate and sends them off in
a single batch. Setting this number high increases throughput as fully
filled frames are sent to the network, but also increases message latency.
The latency can be limited by the use of the
flush_timeout option. |
| flush_timeout() | time in milliseconds | Use global setting. | Specifies the time syslog-ng waits for lines to accumulate in its output
buffer. See the flush_lines option for more
information. |
| frac_digits() | number | 0 | The syslog-ng application can store fractions of a second in the
timestamps according to the ISO8601 format.. The
frac_digits() parameter specifies the number of
digits stored. The digits storing the fractions are padded by zeros if the
original timestamp of the message specifies only seconds. Fractions can
always be stored for the time the message was received. Note that syslog-ng
can add the fractions to non-ISO8601 timestamps as well. |
| fsync() | yes or no | no | Forces an fsync() call on the destination fd after
each write. Note: enabling this option may seriously degrade
performance. |
| log_fifo_size() | number | Use global setting. | The number of entries in the output buffer (output fifo). |
| suppress() | seconds | 0 (disabled) | If several identical log messages would be sent to the destination
without any other messages between the identical messages (for example, an
application repeated an error message ten times), syslog-ng can suppress the
repeated messages and send the message only once, followed by the
Last message repeated n times. message. The
parameter of this option specifies the number of seconds syslog-ng waits for
identical messages. |
| template() | string | A format conforming to the default logfile format. | Specifies a template defining the logformat to be used in the
destination. Macros are described in Section 8.5, “Macros”.
Please note that for network destinations it might not be appropriate to
change the template as it changes the on-wire format of the syslog protocol
which might not be tolerated by stock syslog receivers (like
syslogd or syslog-ng itself). For network
destinations make sure the receiver can cope with the custom format defined.
|
| template_escape() | yes or no | no | Turns on escaping ' and "
in templated output files. This is useful for generating SQL statements and
quoting string contents so that parts of the log message are not interpreted
as commands to the SQL server. |
| throttle() | number | 0 | Sets the maximum number of messages sent to the destination per second.
Use this output-rate-limiting functionality only when using disk-buffer as
well to avoid the risk of losing messages. Specifying
0 or a lower value sets the output limit to
unlimited. |
| time_zone() | timezone offset in seconds | unspecified | Convert timestamps to the timezone specified by this option. If this option is not set then the original timezone information in the message is used. |
| ts_format() | rfc3164, bsd, rfc3339, iso | rfc3164 | Override the global timestamp format (set in the global
ts_format() parameter) for the specific
destination. See also Section 7.7, “A note on timezones and timestamps”. |
Table 8.11. Options for program()
This driver sends messages into an SQL database. The sql()
driver has the following required parameters: type,
database, table,
columns, values.
Declaration:
sql(database_type host_parameters database_parameters [options]);
The sql() destination has the following options:
| Name | Type | Default | Description |
|---|---|---|---|
| columns | string list | "date", "facility", "level", "host", "program", "pid", "message" | Name of the columns storing the data in fieldname
[dbtype] format. The [dbtype]
parameter is optional, and specifies the type of the field. By
default, syslog-ng creates text columns. Note
that not every database engine can index text fields. |
| database | string | n/a | Name of the database that stores the logs. |
| frac_digits() | number | 0 | The syslog-ng application can store fractions of a second in the
timestamps according to the ISO8601 format.. The
frac_digits() parameter specifies the number of
digits stored. The digits storing the fractions are padded by zeros if the
original timestamp of the message specifies only seconds. Fractions can
always be stored for the time the message was received. Note that syslog-ng
can add the fractions to non-ISO8601 timestamps as well. |
| host | hostname or IP address | n/a | Hostname of the database server. Note that Oracle destinations do
not use this parameter, but retrieve the hostname from the
/etc/tnsnames.ora file. |
| indexes | string list | "date", "facility", "host", "program" | The list of columns that are indexed by the database to speed up
searching. To disable indexing for the destination, include the
empty indexes() parameter in the destination,
simply omitting the indexes parameter will
cause syslog-ng to request indexing on the default columns. |
local_time_zone()
|
name of the timezone or the timezone offset | The local timezone. | Sets the timezone used when expanding filename and tablename templates.
The timezone can be specified as using the name of the (e.g.,
time_zone("Europe/Budapest")), or as the timezone
offset (e.g., +01:00). The valid timezone names are
listed under the /usr/share/zoneinfo directory. |
| log_disk_fifo_size() | number | 0 | Size of the hard disk space in bytes that is used as disk buffer.
Available only in syslog-ng Premium Edition when using the
tcp(), tcp6(),
syslog() (when using the
tcp or tls transport methods),
and sql() destinations. Can be also defined as a
global option. See Section 2.14, “Using disk-based buffering” for details on
using the disk buffer. |
| log_fifo_size() | number | Use global setting. | The number of entries in the output buffer (output fifo). |
| null | string | If the content of a column matches the string specified in the
null() parameter, the contents of the
column will be replaced with an SQL NULL value. If unset (by
default), the option does not match on any string. See the Example 8.20, “Using SQL NULL values” for details. |
|
| password | string | n/a | Password of the database user. |
| table | string | n/a | Name of the database table to use (can include macros). When using macros, note that some databases limit the length of table names. |
| time_zone() | timezone offset in seconds | unspecified | Convert timestamps to the timezone specified by this option. If this option is not set then the original timezone information in the message is used. |
| type | mssql, mysql, oracle, pgsql, or sqlite3 | n/a | Specifies the type of the database, i.e., the DBI database driver
to use. Use the mssql option to send logs to
an MSSQL database. See the examples of the databases on the
following sections for details. |
| username | string | n/a | Name of the database user. |
| values | string list | "${R_YEAR}-${R_MONTH}-${R_DAY} ${R_HOUR}:${R_MIN}:${R_SEC}", "$FACILITY", "$LEVEL", "$HOST", "$PROGRAM", "$PID", "$MSGONLY" | The parts of the message to store in the fields specified in the
columns parameter. |
Table 8.12. Options for sql()
![]() |
Note |
|---|---|
|
If you specify To specify the socket to use, set and export the
|
The syslog() driver sends messages to a remote host (e.g.,
a syslog-ng server or relay) on the local intranet or internet using the new
standard syslog protocol developed by IETF (see Section 2.18.2, “IETF-syslog messages” for details about the protocol). The
protocol supports sending messages using the UDP, TCP, or the encrypted TLS
networking protocols.
The required arguments of the driver are the address of the destination host (where messages should be sent) and the transport method (networking protocol).
The udp transport method
automatically sends multicast packets if
a multicast destination address is specified. The tcp and
tls methods do not support multicasting.
Declaration:
syslog(host transport [options]);
These destinations have the following options:
| Name | Type | Default | Description |
|---|---|---|---|
| flags() | no_multi_line, syslog-protocol | empty set |
Flags influence the behavior of the driver. The The |
| flush_lines() | number | Use global setting. | Specifies how many lines are flushed to a destination at a time.
Syslog-ng waits for this number of lines to accumulate and sends them off in
a single batch. Setting this number high increases throughput as fully
filled frames are sent to the network, but also increases message latency.
The latency can be limited by the use of the
flush_timeout option. |
| flush_timeout() | time in milliseconds | Use global setting. | Specifies the time syslog-ng waits for lines to accumulate in its output
buffer. See the flush_lines option for more
information. |
| frac_digits() | number | 0 | The syslog-ng application can store fractions of a second in the
timestamps according to the ISO8601 format.. The
frac_digits() parameter specifies the number of
digits stored. The digits storing the fractions are padded by zeros if the
original timestamp of the message specifies only seconds. Fractions can
always be stored for the time the message was received. Note that syslog-ng
can add the fractions to non-ISO8601 timestamps as well. |
| fsync() | yes or no | no | Forces an fsync() call on the destination fd after
each write. Note: enabling this option may seriously degrade
performance. |
| ip_tos() | number | 0 | Specifies the Type-of-Service value of outgoing packets. |
| ip_ttl() | number | 0 | Specifies the Time-To-Live value of outgoing packets. |
| keep-alive() | yes or no | yes | Specifies whether connections to destinations should be closed when
syslog-ng is restarted (upon the receipt of a SIGHUP signal). Note that this
applies to the client (destination) side of the syslog-ng connections,
server-side (source) connections are always reopened after receiving a HUP
signal unless the keep-alive option is enabled for
the source. When the keep-alive option is enabled,
syslog-ng saves the contents of the output queue of the destination when
receiving a HUP signal, reducing the risk of losing messages. |
| localip() | string | 0.0.0.0 | The IP address to bind to before connecting to target. |
| localport() | number | 0 | The port number to bind to. Messages are sent from this port. |
| log_disk_fifo_size() | number | 0 | Size of the hard disk space in bytes that is used as disk buffer.
Available only in syslog-ng Premium Edition when using the
tcp(), tcp6(),
syslog() (when using the
tcp or tls transport methods),
and sql() destinations. Can be also defined as a
global option. See Section 2.14, “Using disk-based buffering” for details on
using the disk buffer. |
| log_fifo_size() | number | Use global setting. | The number of entries in the output buffer (output fifo). |
| port() or destport() | number | 601 | The port number to connect to. Note that the default port numbers used by syslog-ng do not comply with the latest RFC which was published after the release of syslog-ng 3.0.2, therefore the default port numbers will change in the future releases. |
| so_broadcast() | yes or no | no | This option controls the SO_BROADCAST socket
option required to make syslog-ng send messages to a broadcast address. See
the socket(7) manual page for details. |
| so_keepalive() | yes or no | no | Enables keep-alive messages, keeping the socket open. This only effects TCP and UNIX-stream sockets. See the socket(7) manual page for details. |
| so_rcvbuf() | number | 0 | Specifies the size of the socket receive buffer in bytes. See the socket(7) manual page for details. |
| so_sndbuf() | number | 0 | Specifies the size of the socket send buffer in bytes. See the socket(7) manual page for details. |
| spoof_source() | yes or no | no | Enables source address spoofing. This means that the host running
syslog-ng generates UDP packets with the source IP address matching the
original sender of the message. It is useful when you want to perform some
kind of preprocessing via syslog-ng then forward messages to your central
log management solution with the source address of the original sender. This
option only works for UDP destinations though the original message can be
received by TCP as well. This option is only available if syslog-ng was
compiled using the --enable-spoof-source
configuration option. |
| suppress() | seconds | 0 (disabled) | If several identical log messages would be sent to the destination
without any other messages between the identical messages (for example, an
application repeated an error message ten times), syslog-ng can suppress the
repeated messages and send the message only once, followed by the
Last message repeated n times. message. The
parameter of this option specifies the number of seconds syslog-ng waits for
identical messages. |
| template() | string | A format conforming to the default logfile format. | Specifies a template defining the logformat to be used in the
destination. Macros are described in Section 8.5, “Macros”.
Please note that for network destinations it might not be appropriate to
change the template as it changes the on-wire format of the syslog protocol
which might not be tolerated by stock syslog receivers (like
syslogd or syslog-ng itself). For network
destinations make sure the receiver can cope with the custom format defined.
|
| template_escape() | yes or no | no | Turns on escaping ' and "
in templated output files. This is useful for generating SQL statements and
quoting string contents so that parts of the log message are not interpreted
as commands to the SQL server. |
| throttle() | number | 0 | Sets the maximum number of messages sent to the destination per second.
Use this output-rate-limiting functionality only when using disk-buffer as
well to avoid the risk of losing messages. Specifying
0 or a lower value sets the output limit to
unlimited. |
| time_zone() | timezone offset in seconds | unspecified | Convert timestamps to the timezone specified by this option. If this option is not set then the original timezone information in the message is used. |
| tls() | tls options | n/a | This option sets various TLS specific options like key/certificate files
and trusted CA locations. TLS can be used only with the
tcp transport protocols. See Section 8.10, “TLS options” for more information. |
| transport | udp, tcp, or tls | tcp | Specifies the protocol used to receive messages from the source. |
| ts_format() | rfc3164, bsd, rfc3339, iso | rfc3164 | Override the global timestamp format (set in the global
ts_format() parameter) for the specific
destination. See also Section 7.7, “A note on timezones and timestamps”. |
Table 8.13. Options for syslog() destinations
![]() |
Example 8.21. Using the syslog() driver |
|---|---|
destination d_tcp { syslog(ip"10.1.2.3" transport("tcp") port(1999); localport(999)); };
If name resolution is configured, the hostname of the target server can be used as well. destination d_tcp { syslog(ip"target_host" transport("tcp") port(1999); localport(999)); };
Send the log messages using TLS encryption and use mutual authentication. See Section 8.10, “TLS options” for details on the encryption and authentication options. destination d_syslog_tls{
syslog("10.100.20.40"
transport("tls")
port(6514)
tls(peer-verify(required-trusted)
ca_dir('/opt/syslog-ng/etc/syslog-ng/keys/ca.d/')
key_file('/opt/syslog-ng/etc/syslog-ng/keys/client_key.pem')
cert_file('/opt/syslog-ng/etc/syslog-ng/keys/client_certificate.pem'))
);};
|
This driver sends messages to another host on the local intranet or internet using
the UDP or TCP protocol. The tcp6() and
udp6() drivers use the IPv6 network protocol.
Both drivers have a single required argument specifying the destination host address, where messages should be sent, and several optional parameters. Note that this differs from source drivers, where local bind address is implied, and none of the parameters are required.
The udp() and udp6() drivers
automatically send multicast packets if a multicast destination address is
specified. The tcp() and tcp6()
drivers do not support multicasting.
Declaration:
tcp(host [options]);
udp(host [options]);
tcp6(host [options]);
udp6(host [options]);
These destinations have the following options:
| Name | Type | Default | Description |
|---|---|---|---|
| flags() | no_multi_line, syslog-protocol | empty set |
Flags influence the behavior of the driver. The The |
| flush_lines() | number | Use global setting. | Specifies how many lines are flushed to a destination at a time.
Syslog-ng waits for this number of lines to accumulate and sends them off in
a single batch. Setting this number high increases throughput as fully
filled frames are sent to the network, but also increases message latency.
The latency can be limited by the use of the
flush_timeout option. |
| flush_timeout() | time in milliseconds | Use global setting. | Specifies the time syslog-ng waits for lines to accumulate in its output
buffer. See the flush_lines option for more
information. |
| frac_digits() | number | 0 | The syslog-ng application can store fractions of a second in the
timestamps according to the ISO8601 format.. The
frac_digits() parameter specifies the number of
digits stored. The digits storing the fractions are padded by zeros if the
original timestamp of the message specifies only seconds. Fractions can
always be stored for the time the message was received. Note that syslog-ng
can add the fractions to non-ISO8601 timestamps as well. |
| fsync() | yes or no | no | Forces an fsync() call on the destination fd after
each write. Note: enabling this option may seriously degrade
performance. |
| ip_tos() | number | 0 | Specifies the Type-of-Service value of outgoing packets. |
| ip_ttl() | number | 0 | Specifies the Time-To-Live value of outgoing packets. |
| keep-alive() | yes or no | yes | Specifies whether connections to destinations should be closed when
syslog-ng is restarted (upon the receipt of a SIGHUP signal). Note that this
applies to the client (destination) side of the syslog-ng connections,
server-side (source) connections are always reopened after receiving a HUP
signal unless the keep-alive option is enabled for
the source. When the keep-alive option is enabled,
syslog-ng saves the contents of the output queue of the destination when
receiving a HUP signal, reducing the risk of losing messages. |
| localip() | string | 0.0.0.0 | The IP address to bind to before connecting to target. |
| localport() | number | 0 | The port number to bind to. Messages are sent from this port. |
| log_disk_fifo_size() | number | 0 | Size of the hard disk space in bytes that is used as disk buffer.
Available only in syslog-ng Premium Edition when using the
tcp(), tcp6(),
syslog() (when using the
tcp or tls transport methods),
and sql() destinations. Can be also defined as a
global option. See Section 2.14, “Using disk-based buffering” for details on
using the disk buffer. |
| log_fifo_size() | number | Use global setting. | The number of entries in the output buffer (output fifo). |
| port() or destport() | number | 514 | The port number to connect to. Note that the default port numbers used by syslog-ng do not comply with the latest RFC which was published after the release of syslog-ng 3.0.2, therefore the default port numbers will change in the future releases. |
| so_broadcast() | yes or no | no | This option controls the SO_BROADCAST socket
option required to make syslog-ng send messages to a broadcast address. See
the socket(7) manual page for details. |
| so_keepalive() | yes or no | no | Enables keep-alive messages, keeping the socket open. This only effects TCP and UNIX-stream sockets. See the socket(7) manual page for details. |
| so_rcvbuf() | number | 0 | Specifies the size of the socket receive buffer in bytes. See the socket(7) manual page for details. |
| so_sndbuf() | number | 0 | Specifies the size of the socket send buffer in bytes. See the socket(7) manual page for details. |
| spoof_source() | yes or no | no | Enables source address spoofing. This means that the host running
syslog-ng generates UDP packets with the source IP address matching the
original sender of the message. It is useful when you want to perform some
kind of preprocessing via syslog-ng then forward messages to your central
log management solution with the source address of the original sender. This
option only works for UDP destinations though the original message can be
received by TCP as well. This option is only available if syslog-ng was
compiled using the --enable-spoof-source
configuration option. |
| suppress() | seconds | 0 (disabled) | If several identical log messages would be sent to the destination
without any other messages between the identical messages (for example, an
application repeated an error message ten times), syslog-ng can suppress the
repeated messages and send the message only once, followed by the
Last message repeated n times. message. The
parameter of this option specifies the number of seconds syslog-ng waits for
identical messages. |
| template() | string | A format conforming to the default logfile format. | Specifies a template defining the logformat to be used in the
destination. Macros are described in Section 8.5, “Macros”.
Please note that for network destinations it might not be appropriate to
change the template as it changes the on-wire format of the syslog protocol
which might not be tolerated by stock syslog receivers (like
syslogd or syslog-ng itself). For network
destinations make sure the receiver can cope with the custom format defined.
|
| template_escape() | yes or no | no | Turns on escaping ' and "
in templated output files. This is useful for generating SQL statements and
quoting string contents so that parts of the log message are not interpreted
as commands to the SQL server. |
| throttle() | number | 0 | Sets the maximum number of messages sent to the destination per second.
Use this output-rate-limiting functionality only when using disk-buffer as
well to avoid the risk of losing messages. Specifying
0 or a lower value sets the output limit to
unlimited. |
| time_zone() | timezone offset in seconds | unspecified | Convert timestamps to the timezone specified by this option. If this option is not set then the original timezone information in the message is used. |
| tls() | tls options | n/a | This option sets various TLS specific options like key/certificate files
and trusted CA locations. TLS can be used only with the
tcp transport protocols. See Section 8.10, “TLS options” for more information. |
| ts_format() | rfc3164, bsd, rfc3339, iso | rfc3164 | Override the global timestamp format (set in the global
ts_format() parameter) for the specific
destination. See also Section 7.7, “A note on timezones and timestamps”. |
Table 8.14. Options for tcp, tcp6, udp, and udp6 destinations
These drivers send messages to a unix socket in either
SOCK_STREAM or SOCK_DGRAM mode.
Both drivers have a single required argument specifying the name of the socket to connect to.
Declaration:
unix-stream(filename [options]);
unix-dgram(filename [options]);
The unix-stream() and unix-dgram()
destinations have the following options:
| Name | Type | Default | Description |
|---|---|---|---|
| flags() | no_multi_line, syslog-protocol | empty set |
Flags influence the behavior of the driver. The The |
| flush_lines() | number | Use global setting. | Specifies how many lines are flushed to a destination at a time.
Syslog-ng waits for this number of lines to accumulate and sends them off in
a single batch. Setting this number high increases throughput as fully
filled frames are sent to the network, but also increases message latency.
The latency can be limited by the use of the
flush_timeout option. |
| flush_timeout() | time in milliseconds | Use global setting. | Specifies the time syslog-ng waits for lines to accumulate in its output
buffer. See the flush_lines option for more
information. |
| frac_digits() | number | 0 | The syslog-ng application can store fractions of a second in the
timestamps according to the ISO8601 format.. The
frac_digits() parameter specifies the number of
digits stored. The digits storing the fractions are padded by zeros if the
original timestamp of the message specifies only seconds. Fractions can
always be stored for the time the message was received. Note that syslog-ng
can add the fractions to non-ISO8601 timestamps as well. |
| fsync() | yes or no | no | Forces an fsync() call on the destination fd after
each write. Note: enabling this option may seriously degrade
performance. |
| log_fifo_size() | number | Use global setting. | The number of entries in the output buffer (output fifo). |
| keep-alive() | yes or no | yes | Specifies whether connections to destinations should be closed when
syslog-ng is restarted (upon the receipt of a SIGHUP signal). Note that this
applies to the client (destination) side of the syslog-ng connections,
server-side (source) connections are always reopened after receiving a HUP
signal unless the keep-alive option is enabled for
the source. When the keep-alive option is enabled,
syslog-ng saves the contents of the output queue of the destination when
receiving a HUP signal, reducing the risk of losing messages. |
| so_broadcast() | yes or no | no | This option controls the SO_BROADCAST socket
option required to make syslog-ng send messages to a broadcast address. See
the socket(7) manual page for details. |
| so_keepalive() | yes or no | no | Enables keep-alive messages, keeping the socket open. This only effects TCP and UNIX-stream sockets. See the socket(7) manual page for details. |
| so_rcvbuf() | number | 0 | Specifies the size of the socket receive buffer in bytes. See the socket(7) manual page for details. |
| so_sndbuf() | number | 0 | Specifies the size of the socket send buffer in bytes. See the socket(7) manual page for details. |
| suppress() | seconds | 0 (disabled) | If several identical log messages would be sent to the destination
without any other messages between the identical messages (for example, an
application repeated an error message ten times), syslog-ng can suppress the
repeated messages and send the message only once, followed by the
Last message repeated n times. message. The
parameter of this option specifies the number of seconds syslog-ng waits for
identical messages. |
| template() | string | A format conforming to the default logfile format. | Specifies a template defining the logformat to be used in the
destination. Macros are described in Section 8.5, “Macros”.
Please note that for network destinations it might not be appropriate to
change the template as it changes the on-wire format of the syslog protocol
which might not be tolerated by stock syslog receivers (like
syslogd or syslog-ng itself). For network
destinations make sure the receiver can cope with the custom format defined.
|
| template_escape() | yes or no | no | Turns on escaping ' and "
in templated output files. This is useful for generating SQL statements and
quoting string contents so that parts of the log message are not interpreted
as commands to the SQL server. |
| throttle() | number | 0 | Sets the maximum number of messages sent to the destination per second.
Use this output-rate-limiting functionality only when using disk-buffer as
well to avoid the risk of losing messages. Specifying
0 or a lower value sets the output limit to
unlimited. |
| time_zone() | timezone offset in seconds | unspecified | Convert timestamps to the timezone specified by this option. If this option is not set then the original timezone information in the message is used. |
| ts_format() | rfc3164, bsd, rfc3339, iso | rfc3164 | Override the global timestamp format (set in the global
ts_format() parameter) for the specific
destination. See also Section 7.7, “A note on timezones and timestamps”. |
Table 8.15. Options for unix-stream() and unix-dgram()
This driver writes messages to the terminal of a logged-in user.
The usertty() driver has a single required argument,
specifying a username who should receive a copy of matching messages.
Declaration:
usertty(username);
The usertty() does not have any further options nor does it
support templates.
![]() |
Example 8.25. Using the usertty() driver |
|---|---|
destination d_usertty { usertty("root"); }; |
© 2007-2008 BalaBit IT Security
Please send your comments or documentation bugs to: documentation@balabit.com