HTTP destination options
The http
destination of AxoSyslog can directly post log messages to web services using the HTTP protocol. The http
destination has the following options.
accept-encoding()
Type: | "identity" , "gzip" , "deflate" , "all" |
Default: |
Description: Use accept-encoding()
to request the server to compress the HTTP responses. (AxoSyslog doesn’t currently use them, but they still contribute to network traffic.) To compress the messages sent by AxoSyslog, see the content-compression()
option.
Use "identity"
for no compression.
- If you want to accept multiple compression types, list them separated by commas inside the quotation mark.
- To enable all available compression types, use
"all"
.
For example:
destination d_http_compressed{
http(url("127.0.0.1:80"), content-compression("deflate"), accept-encoding("all"));
};
accept-redirects()
Type: | yes or no |
Default: |
Description: Accept and follow redirect responses.
azure-auth-header()
See The Azure auth header plugin.
batch-bytes()
Accepted values: | number [bytes] |
Default: | none |
Description: Sets the maximum size of payload in a batch. If the size of the messages reaches this value, AxoSyslog sends the batch to the destination even if the number of messages is less than the value of the batch-lines()
option.
Note that if the batch-timeout()
option is enabled and the queue becomes empty, AxoSyslog flushes the messages only if batch-timeout()
expires, or the batch reaches the limit set in batch-bytes()
.
Available in AxoSyslog version 3.19 and later.
For details on how this option influences HTTP batch mode, see http: Posting messages over HTTP without Java
batch-lines()
Type: | number |
Default: | 1 |
Description: Specifies how many lines are flushed to a destination in one batch. The AxoSyslog application waits for this number of lines to accumulate and sends them off in a single batch. Increasing this number increases throughput as more messages are sent in a single batch, but also increases message latency.
For example, if you set batch-lines()
to 100, AxoSyslog waits for 100 messages.
If the batch-timeout()
option is disabled, the AxoSyslog application flushes the messages if it has sent batch-lines()
number of messages, or the queue became empty. If you stop or reload AxoSyslog or in case of network sources, the connection with the client is closed, AxoSyslog automatically sends the unsent messages to the destination.
Note that if the batch-timeout()
option is enabled and the queue becomes empty, AxoSyslog flushes the messages only if batch-timeout()
expires, or the batch reaches the limit set in batch-lines()
.
For optimal performance, make sure that the AxoSyslog source that feeds messages to this destination is configured properly: the value of the log-iw-size()
option of the source must be higher than the batch-lines()
*workers()
of the destination. Otherwise, the size of the batches cannot reach the batch-lines()
limit.
batch-timeout()
Type: | time in milliseconds |
Default: | -1 (disabled) |
Description: Specifies the time AxoSyslog waits for lines to accumulate in the output buffer. The AxoSyslog application sends batches to the destinations evenly. The timer starts when the first message arrives to the buffer, so if only few messages arrive, AxoSyslog sends messages to the destination at most once every batch-timeout()
milliseconds.
For details on how this option influences HTTP batch mode, see http: Posting messages over HTTP without Java
body()
Type: | string or template |
Default: |
Description: The body of the HTTP request, for example, body("${ISODATE} ${MESSAGE}")
. You can use strings, macros, and template functions in the body. If not set, it will contain the message received from the source by default.
body-prefix()
Accepted values: | string |
Default: | none |
Description: The string AxoSyslog puts at the beginning of the body of the HTTP request, before the log message. Available in AxoSyslog version 3.18 and later.
For details on how this option influences HTTP batch mode, see http: Posting messages over HTTP without Java
body-suffix()
Accepted values: | string |
Default: | none |
Description: The string AxoSyslog puts to the end of the body of the HTTP request, after the log message. Available in AxoSyslog version 3.18 and later.
For details on how this option influences HTTP batch mode, see http: Posting messages over HTTP without Java.
cloud-auth()
Authenticate to cloud-based services, for example, GCP, using service accounts.
gcp()
Authenticate to GCP service accounts. For example:
cloud-auth(
gcp(
user-managed-service-account(
name("your-user@your-project.iam.gserviceaccount.com")
metadata-url("your-metadata-server:8080")
)
)
)
service-account()
Authenticate to a service account using Service Account Key-Based Authentication. This method works both inside and outside GCP It uses a service account key generated and downloaded through the GCP IAM & Admin console. The long-term service account key is used to generate short-term tokens for authentication (also called self-signed JWT).
audience()
Type: | string |
Default: |
google-pubsub()
destination, the audience()
option is set to https://pubsub.googleapis.com/google.pubsub.v1.Publisher
. Don’t change it.
key()
Type: | string (path) |
Default: |
Path to the service account key.
token-validity-duration()
Type: | integer (seconds) |
Default: | 3600 |
user-managed-service-account()
Available in AxoSyslog version 4.6 and later.
user-managed-service-account()
method is only available for VMs running within GCP.
Authenticate to a user-managed service account of a GCP virtual machine using the VM Metadata Server Method. AxoSyslog interacts with the internal GCP metadata server, which provides an OAuth2 token for authentication. You can attach the default service accounts as well.
metadata-url()
Type: | string |
Default: | http://metadata.google.internal/computeMetadata/v1/instance/service-accounts |
The URL of the metadata server. When specifying the port, use the URL:port
format.
name()
Type: | string |
Default: | default |
Name of the service account to use.
ca-dir()
Accepted values: | Directory name |
Default: | none |
Description: The name of a directory that contains a set of trusted CA certificates in PEM format. The CA certificate files have to be named after the 32-bit hash of the subject’s name. This naming can be created using the c_rehash utility in openssl. For an example, see Configuring TLS on the AxoSyslog clients. The AxoSyslog application uses the CA certificates in this directory to validate the certificate of the peer.
This option can be used together with the optional ca-file()
option.
An alternative way to specify this option is to put it into a tls()
block, together with any other TLS options. This allows you to separate these options and ensure better readability.
Make sure that you specify TLS options either using their own dedicated option (ca-dir()
, ca-file()
, cert-file()
, cipher-suite()
, key-file()
, peer-verify()
, and ssl-version()
), or using the tls()
block and inserting the relevant options within tls()
. Avoid mixing the two methods. In case you do specify TLS options in both ways, the one that comes later in the configuration file will take effect.
Declaration:
destination d_http {
http(
url("http://127.0.0.1:8080")
tls(
ca-dir("dir")
cert-file("cert")
cipher-suite("cipher")
key-file("key")
peer-verify(yes|no)
ssl-version(<the permitted SSL/TLS version>)
)
);
};
ca-file()
Accepted values: | Filename |
Default: | none |
Description: Name of a file that contains an X.509 CA certificate (or a certificate chain) in PEM format. The AxoSyslog application uses this certificate to validate the certificate of the HTTPS server. If the file contains a certificate chain, the file must begin with the certificate of the host, followed by the CA certificate that signed the certificate of the host, and any other signing CAs in order.
An alternative way to specify this option is to put it into a tls()
block, together with any other TLS options. This allows you to separate these options and ensure better readability.
Make sure that you specify TLS options either using their own dedicated option (ca-dir()
, ca-file()
, cert-file()
, cipher-suite()
, key-file()
, peer-verify()
, and ssl-version()
), or using the tls()
block and inserting the relevant options within tls()
. Avoid mixing the two methods. In case you do specify TLS options in both ways, the one that comes later in the configuration file will take effect.
Declaration:
destination d_http {
http(
url("http://127.0.0.1:8080")
tls(
ca-file("ca")
cert-file("cert")
cipher-suite("cipher")
key-file("key")
peer-verify(yes|no)
ssl-version(<the permitted SSL/TLS version>)
)
);
};
cert-file()
Accepted values: | Filename |
Default: | none |
Description: Name of a file, that contains an X.509 certificate (or a certificate chain) in PEM format, suitable as a TLS certificate, matching the private key set in the key-file()
option. The AxoSyslog application uses this certificate to authenticate the AxoSyslog client on the destination server. If the file contains a certificate chain, the file must begin with the certificate of the host, followed by the CA certificate that signed the certificate of the host, and any other signing CAs in order.
An alternative way to specify this option is to put it into a tls()
block, together with any other TLS options. This allows you to separate these options and ensure better readability.
Make sure that you specify TLS options either using their own dedicated option (ca-dir()
, ca-file()
, cert-file()
, cipher-suite()
, key-file()
, peer-verify()
, and ssl-version()
), or using the tls()
block and inserting the relevant options within tls()
. Avoid mixing the two methods. In case you do specify TLS options in both ways, the one that comes later in the configuration file will take effect.
Declaration:
destination d_http {
http(
url("http://127.0.0.1:8080")
tls(
ca-dir("dir")
ca-file("ca")
cert-file("cert")
cipher-suite("cipher")
key-file("key")
peer-verify(yes|no)
ssl-version(<the permitted SSL/TLS version>)
)
);
};
cipher-suite()
Accepted values: | Name of a cipher, or a colon-separated list |
Default: | Depends on the OpenSSL version that AxoSyslog uses |
Description: Specifies the cipher, hash, and key-exchange algorithms used for the encryption, for example, ECDHE-ECDSA-AES256-SHA384
. The list of available algorithms depends on the version of OpenSSL used to compile AxoSyslog. To specify multiple ciphers, separate the cipher names with a colon, and enclose the list between double-quotes, for example:
cipher-suite("ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384")
For a list of available algorithms, execute the openssl ciphers -v
command. The first column of the output contains the name of the algorithms to use in the cipher-suite()
option, the second column specifies which encryption protocol uses the algorithm (for example, TLSv1.2
). That way, the cipher-suite()
also determines the encryption protocol used in the connection: to disable SSLv3, use an algorithm that is available only in TLSv1.2, and that both the client and the server supports. You can also specify the encryption protocols using ssl-options().
You can also use the following command to automatically list only ciphers permitted in a specific encryption protocol, for example, TLSv1.2
:
echo "cipher-suite(\"$(openssl ciphers -v | grep TLSv1.2 | awk '{print $1}' | xargs echo -n | sed 's/ /:/g' | sed -e 's/:$//')\")"
Note that starting with version 3.10, when AxoSyslog receives TLS-encrypted connections, the order of ciphers set on the AxoSyslog server takes precedence over the client settings.
content-compression()
Type: | "identity" , "gzip" , "deflate" , "all" |
Default: |
Description: Use content-compression()
to compress the messages sent by AxoSyslog. To accept compressed responses from the server, see the accept-encoding()
option.
Use "identity"
for no compression.
- If you want to accept multiple compression types, list them separated by commas inside the quotation mark.
- To enable all available compression types, use
"all"
.
For example:
destination d_http_compressed{
http(url("127.0.0.1:80"), content-compression("deflate"), accept-encoding("all"));
};
An alternative way to specify this option is to put it into a tls()
block, together with any other TLS options. This allows you to separate these options and ensure better readability.
Make sure that you specify TLS options either using their own dedicated option (ca-dir()
, ca-file()
, cert-file()
, cipher-suite()
, key-file()
, peer-verify()
, and ssl-version()
), or using the tls()
block and inserting the relevant options within tls()
. Avoid mixing the two methods. In case you do specify TLS options in both ways, the one that comes later in the configuration file will take effect.
Declaration:
destination d_http {
http(
url("http://127.0.0.1:8080")
tls(
ca-dir("dir")
ca-file("ca")
cert-file("cert")
cipher-suite("cipher")
key-file("key")
peer-verify(yes|no)
ssl-version(<the permitted SSL/TLS version>)
)
);
};
delimiter()
Accepted values: | string |
Default: | newline character |
Description: By default, AxoSyslog separates the log messages of the batch with a newline character. You can specify a different delimiter by using the delimiter()
option. Available in AxoSyslog version 3.18 and later.
For details on how this option influences HTTP batch mode, see http: Posting messages over HTTP without Java
disk-buffer()
Description: This option enables putting outgoing messages into the disk buffer of the destination to avoid message loss in case of a system failure on the destination side. It has the following options:
capacity-bytes()
Type: | number (bytes) |
---|---|
Default: | 1MiB |
Description: This is a required option. The maximum size of the disk-buffer in bytes. The minimum value is 1048576
bytes. If you set a smaller value, the minimum value will be used automatically. It replaces the old log-disk-fifo-size()
option.
In AxoSyslog version 4.2 and earlier, this option was called disk-buf-size()
.
compaction()
Type: | yes/no |
---|---|
Default: | no |
Description: If set to yes
, AxoSyslog prunes the unused space in the LogMessage representation, making the disk queue size smaller at the cost of some CPU time. Setting the compaction()
argument to yes
is recommended when numerous name-value pairs are unset during processing, or when the same names are set multiple times.
unset()
rewrite operation is not enough, as due to performance reasons that help when AxoSyslog is CPU bound, the internal representation of a LogMessage
will not release the memory associated with these name-value pairs. In some cases, however, the size of this overhead becomes significant (the raw message size can grow up to four times its original size), which unnecessarily increases the disk queue file size. For these cases, the compaction will drop unset
values, making the LogMessage
representation smaller at the cost of some CPU time required to perform compaction.
dir()
Type: | string |
---|---|
Default: | N/A |
Description: Defines the folder where the disk-buffer files are stored.
When creating a new dir()
option for a disk buffer, or modifying an existing one, make sure you delete the persist file.
AxoSyslog creates disk-buffer files based on the path recorded in the persist file. Therefore, if the persist file is not deleted after modifying the dir()
option, then following a restart, AxoSyslog will look for or create disk-buffer files in their old location. To ensure that AxoSyslog uses the new dir()
setting, the persist file must not contain any information about the destinations which the disk-buffer file in question belongs to.
dir()
path provided by the user does not exist, AxoSyslog creates the path with the same permission as the running instance.
flow-control-window-bytes()
Type: | number (bytes) |
---|---|
Default: | 163840000 |
Description: Use this option if the option reliable()
is set to yes
. This option contains the size of the messages in bytes that is used in the memory part of the disk buffer. It replaces the old log-fifo-size()
option. It does not inherit the value of the global log-fifo-size()
option, even if it is provided. Note that this option will be ignored if the option reliable()
is set to no
.
In AxoSyslog version 4.2 and earlier, this option was called mem-buf-size()
.
flow-control-window-size()
Type: | number(messages) |
---|---|
Default: | 10000 |
Description: Use this option if the option reliable()
is set to no
. This option contains the number of messages stored in overflow queue. It replaces the old log-fifo-size()
option. It inherits the value of the global log-fifo-size()
option if provided. If it is not provided, the default value is 10000
messages. Note that this option will be ignored if the option reliable()
is set to yes
.
In AxoSyslog version 4.2 and earlier, this option was called mem-buf-length()
.
front-cache-size()
Type: | number(messages) |
---|---|
Default: | 1000 |
Description: The number of messages stored in the output buffer of the destination. Note that if you change the value of this option and the disk-buffer already exists, the change will take effect when the disk-buffer becomes empty.
Options reliable()
and capacity-bytes()
are required options.
In AxoSyslog version 4.2 and earlier, this option was called qout-size()
.
prealloc()
Type: | yes/no |
---|---|
Default: | no |
Description:
By default, AxoSyslog doesn’t reserve the disk space for the disk-buffer file, since in a properly configured and sized environment the disk-buffer is practically empty, so a large preallocated disk-buffer file is just a waste of disk space. But a preallocated buffer can prevent other data from using the intended buffer space (and elicit a warning from the OS if disk space is low), preventing message loss if the buffer is actually needed. To avoid this problem, when using AxoSyslog 4.0 or later, you can preallocate the space for your disk-buffer files by setting prealloc(yes)
.
In addition to making sure that the required disk space is available when needed, preallocated disk-buffer files provide radically better (3-4x) performance as well: in case of an outage the amount of messages stored in the disk-buffer is continuously growing, and using large continuous files is faster, than constantly waiting on a file to change its size.
If you are running AxoSyslog on a dedicated host (always recommended for any high-volume settings), use prealloc(yes)
.
Available in AxoSyslog 4.0 and later.
reliable()
Type: | yes/no |
---|---|
Default: | no |
Description: If set to yes
, AxoSyslog cannot lose logs in case of reload/restart, unreachable destination or AxoSyslog crash. This solution provides a slower, but reliable disk-buffer option. It is created and initialized at startup and gradually grows as new messages arrive. If set to no
, the normal disk-buffer will be used. This provides a faster, but less reliable disk-buffer option.
reliable()
option when there are messages in the disk-buffer, the messages stored in the disk-buffer will be lost.
truncate-size-ratio()
Type: | number((between 0 and 1)) |
---|---|
Default: | 1 (do not truncate) |
Description: Limits the truncation of the disk-buffer file. Truncating the disk-buffer file can slow down the disk IO operations, but it saves disk space. By default, AxoSyslog version 4.0 and later doesn’t truncate disk-buffer files by default (truncate-size-ratio(1)
). Earlier versions freed the disk-space when at least 10% of the disk-buffer file could be freed (truncate-size-ratio(0.1)
).
AxoSyslog only truncates the file if the possible disk gain is more than truncate-size-ratio()
times capacity-bytes()
.
- Smaller values free disk space quicker.
- Larger ratios result in better performance.
If you want to avoid performance fluctuations:
- use
truncate-size-ratio(1)
(never truncate), or - use
prealloc(yes)
to reserve the entire size of the disk-buffer on disk.
truncate-size-ratio()
. Only change its value if you understand the performance implications of doing so.
Example: Examples for using disk-buffer()
In the following case reliable disk-buffer() is used.
destination d_demo {
network(
"127.0.0.1"
port(3333)
disk-buffer(
flow-control-window-bytes(10000)
capacity-bytes(2000000)
reliable(yes)
dir("/tmp/disk-buffer")
)
);
};
In the following case normal disk-buffer() is used.
destination d_demo {
network(
"127.0.0.1"
port(3333)
disk-buffer(
flow-control-window-size(10000)
capacity-bytes(2000000)
reliable(no)
dir("/tmp/disk-buffer")
)
);
};
flush-lines()
Type: | number |
Default: | Use global setting (exception: for http() destination, the default is 1). |
Description: Specifies how many lines are flushed to a destination at a time. The AxoSyslog application waits for this number of lines to accumulate and sends them off in a single batch. Increasing this number increases throughput as more messages are sent in a single batch, but also increases message latency.
The AxoSyslog application flushes the messages if it has sent flush-lines()
number of messages, or the queue became empty. If you stop or reload AxoSyslog or in case of network sources, the connection with the client is closed, AxoSyslog automatically sends the unsent messages to the destination.
For optimal performance when sending messages to an AxoSyslog server, make sure that the value of flush-lines()
is smaller than the window size set in the log-iw-size()
option in the source of your server.
flush-timeout()
Type: | time in milliseconds |
Default: | 10000 [milliseconds] |
Description: Specifies the time AxoSyslog waits for lines to accumulate in the output buffer. The AxoSyslog application sends flushes to the destinations evenly. The timer starts when the first message arrives to the buffer, so if only few messages arrive, AxoSyslog sends messages to the destination at most once every flush-timeout()
seconds.
frac-digits()
Type: | number |
Default: | 0 |
Description: The AxoSyslog 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.
frac-digits()
option is set to a value higher than 6, AxoSyslog will truncate the fraction seconds in the timestamps after 6 digits.
headers()
Type: | string list |
Default: |
Description: Custom HTTP headers to include in the request, for example, headers("HEADER1: header1", "HEADER2: header2")
. If not set, only the default headers are included, but no custom headers.
The following headers are included by default:
-
X-Syslog-Host:
<host>
-
X-Syslog-Program:
<program>
-
X-Syslog-Facility:
<facility>
-
X-Syslog-Level:
<loglevel/priority>
hook-commands()
Description: This option makes it possible to execute external programs when the relevant driver is initialized or torn down. The hook-commands()
can be used with all source and destination drivers with the exception of the usertty()
and internal()
drivers.
Using hook-commands()
when AxoSyslog starts or stops
To execute an external program when AxoSyslog starts or stops, use the following options:
startup()
Type: | string |
---|---|
Default: | N/A |
Description: Defines the external program that is executed as AxoSyslog starts.
shutdown()
Type: | string |
---|---|
Default: | N/A |
Description: Defines the external program that is executed as AxoSyslog stops.
Using the hook-commands() when AxoSyslog reloads
To execute an external program when the AxoSyslog configuration is initiated or torn down, for example, on startup/shutdown or during a AxoSyslog reload, use the following options:
setup()
Type: | string |
---|---|
Default: | N/A |
Description: Defines an external program that is executed when the AxoSyslog configuration is initiated, for example, on startup or during a AxoSyslog reload.
teardown()
Type: | string |
---|---|
Default: | N/A |
Description: Defines an external program that is executed when the AxoSyslog configuration is stopped or torn down, for example, on shutdown or during a AxoSyslog reload.
Example: Using hook-commands() with a network source
In the following example, the hook-commands()
is used with the network()
driver and it opens an iptables port automatically as AxoSyslog is started/stopped.
The assumption in this example is that the LOGCHAIN
chain is part of a larger ruleset that routes traffic to it. Whenever the AxoSyslog created rule is there, packets can flow, otherwise the port is closed.
source {
network(transport(udp)
hook-commands(
startup("iptables -I LOGCHAIN 1 -p udp --dport 514 -j ACCEPT")
shutdown("iptables -D LOGCHAIN 1")
)
);
};
key-file()
Accepted values: | Filename |
Default: | none |
Description: The name of a file that contains an unencrypted private key in PEM format, suitable as a TLS key. If properly configured, the AxoSyslog application uses this private key and the matching certificate (set in the cert-file()
option) to authenticate the AxoSyslog client on the destination server.
The http()
destination supports only unencrypted key files (that is, the private key cannot be password-protected).
An alternative way to specify this option is to put it into a tls()
block, together with any other TLS options. This allows you to separate these options and ensure better readability.
Make sure that you specify TLS options either using their own dedicated option (ca-dir()
, ca-file()
, cert-file()
, cipher-suite()
, key-file()
, peer-verify()
, and ssl-version()
), or using the tls()
block and inserting the relevant options within tls()
. Avoid mixing the two methods. In case you do specify TLS options in both ways, the one that comes later in the configuration file will take effect.
Declaration:
destination d_http {
http(
url("http://127.0.0.1:8080")
tls(
ca-dir("dir")
ca-file("ca")
cert-file("cert")
cipher-suite("cipher")
key-file("key")
peer-verify(yes|no)
ssl-version(<the permitted SSL/TLS version>)
)
);
};
local-time-zone()
Type: | name of the timezone, or the timezone offset |
Default: | The local timezone. |
Description: Sets the timezone used when expanding filename and tablename templates.
The timezone can be specified by using the name, for example, time-zone("Europe/Budapest")
), or as the timezone offset in +/-HH:MM format, for example, +01:00
). On Linux and UNIX platforms, the valid timezone names are listed under the /usr/share/zoneinfo
directory.
log-fifo-size()
Type: | number |
Default: | Use global setting. |
Description: The number of messages that the output queue can store.
method()
Type: | POST or PUT |
Default: | POST |
Description: Specifies the HTTP method to use when sending the message to the server.
ocsp-stapling-verify
Accepted values: | yes , no |
Default: | no |
Available in AxoSyslog 4.0 and later.
Description: When OCSP stapling verification is enabled, AxoSyslog requests the server to send back its OCSP status. AxoSyslog verifies this status response using the trust store you have configured using the ca-file()
, ca-dir()
, or the pkcs12-file()
options.
Example configuration:
destination {
http(url("https://example.com") method("POST") tls(peer-verify(yes) ocsp-stapling-verify(yes)));
};
on-error()
Type: | One of: drop-message , drop-property , fallback-to-string , silently-drop-message , silently-drop-property , silently-fallback-to-string |
---|---|
Default: | Use the global setting (which defaults to drop-message ) |
Description: Controls what happens when type-casting fails and AxoSyslog cannot convert some data to the specified type. By default, AxoSyslog drops the entire message and logs the error. Currently the value-pairs()
option uses the settings of on-error()
.
drop-message
: Drop the entire message and log an error message to theinternal()
source. This is the default behavior of AxoSyslog.drop-property
: Omit the affected property (macro, template, or message-field) from the log message and log an error message to theinternal()
source.fallback-to-string
: Convert the property to string and log an error message to theinternal()
source.silently-drop-message
: Drop the entire message silently, without logging the error.silently-drop-property
: Omit the affected property (macro, template, or message-field) silently, without logging the error.silently-fallback-to-string
: Convert the property to string silently, without logging the error.
password()
Type: | string |
Default: |
Description: The password that AxoSyslog uses to authenticate on the server where it sends the messages.
peer-verify()
Accepted values: | yes or no |
Default: | yes |
Description: Verification method of the peer. The following table summarizes the possible options and their results depending on the certificate of the peer.
The remote peer has: | ||||
---|---|---|---|---|
no certificate | invalid certificate | valid certificate | ||
Local peer-verify() setting | no (optional-untrusted) | TLS-encryption | TLS-encryption | TLS-encryption |
yes (required-trusted) | rejected connection | rejected connection | TLS-encryption |
For untrusted certificates only the existence of the certificate is checked, but it does not have to be valid — AxoSyslog accepts the certificate even if it is expired, signed by an unknown CA, or its CN and the name of the machine mismatches.
An alternative way to specify this option is to put it into a tls()
block, together with any other TLS options. This allows you to separate these options and ensure better readability.
Make sure that you specify TLS options either using their own dedicated option (ca-dir()
, ca-file()
, cert-file()
, cipher-suite()
, key-file()
, peer-verify()
, and ssl-version()
), or using the tls()
block and inserting the relevant options within tls()
. Avoid mixing the two methods. In case you do specify TLS options in both ways, the one that comes later in the configuration file will take effect.
persist-name()
Type: | string |
Default: | N/A |
Description: If you receive the following error message during AxoSyslog startup, set the persist-name()
option of the duplicate drivers:
Error checking the uniqueness of the persist names, please override it with persist-name option. Shutting down.
This error happens if you use identical drivers in multiple sources, for example, if you configure two file sources to read from the same file. In this case, set the persist-name()
of the drivers to a custom string, for example, persist-name("example-persist-name1")
.
proxy()
Type: | The proxy server address, in `proxy("PROXY_IP:PORT")` format. For example, `proxy("http://myproxy:3128")` |
Default: | None |
Description:
You can use the proxy()
option to configure the HTTP driver in all HTTP-based destinations to use a specific HTTP proxy that is independent from the proxy configured for the system.
Alternatively, you can leave the HTTP as-is, in which case the driver leaves the default http_proxy
and https_proxy
environment variables unmodified.
Configuring the <code>proxy()</code> option overwrites the default <code>http_proxy</code> and <code>https_proxy</code> environment variables.
Example: the proxy() option in configuration
The following example illustrates including the proxy()
option in your configuration.
destination {
http( url("SYSLOG_SERVER_IP:PORT") proxy("PROXY_IP:PORT") method("POST"));
};
python-http-header()
See The Python HTTP header plugin
response-action()
Type: | list |
Default: | N/A (see below) |
Description: Specifies what AxoSyslog does with the log message, based on the response code received from the HTTP server. If the server returns a status code beginning with 2 (for example, 200), AxoSyslog assumes the message was successfully sent. Otherwise, the action listed in the following table is applied. For status codes not listed in the following table, if the status code begins with 2 (for example, 299), AxoSyslog assumes the message was successfully sent. For other status codes, AxoSyslog disconnects. The following actions are possible:
-
disconnect
: Keep trying to resend the message indefinitely. -
drop
: Drop the message without trying to resend it. -
retry
: Retry sending the message for a maximum ofretries()
times (3 by default). -
success
: Assume the message was successfully sent.
|------+-----------------------------------+------------|
| code | explanation | action |
|------+-----------------------------------+------------|
| 100 | "Continue" | disconnect |
| 101 | "Switching Protocols" | disconnect |
| 102 | "Processing" | retry |
| 103 | "Early Hints" | retry |
| 200 | "OK" | success |
| 201 | "Created" | success |
| 202 | "Accepted" | success |
| 203 | "Non-Authoritative Information" | success |
| 204 | "No Content" | success |
| 205 | "Reset Content" | success |
| 206 | "Partial Content" | success |
| 300 | "Multiple Choices" | disconnect |
| 301 | "Moved Permanently" | disconnect |
| 302 | "Found" | disconnect |
| 303 | "See Other" | disconnect |
| 304 | "Not Modified" | retry |
| 307 | "Temporary Redirect" | disconnect |
| 308 | "Permanent Redirect" | disconnect |
| 400 | "Bad Request" | disconnect |
| 401 | "Unauthorized" | disconnect |
| 402 | "Payment Required" | disconnect |
| 403 | "Forbidden" | disconnect |
| 404 | "Not Found" | disconnect |
| 405 | "Method Not Allowed" | disconnect |
| 406 | "Not Acceptable" | disconnect |
| 407 | "Proxy Authentication Required" | disconnect |
| 408 | "Request Timeout" | disconnect |
| 409 | "Conflict" | disconnect |
| 410 | "Gone" | drop |
| 411 | "Length Required" | disconnect |
| 412 | "Precondition Failed" | disconnect |
| 413 | "Payload Too Large" | disconnect |
| 414 | "URI Too Long" | disconnect |
| 415 | "Unsupported Media Type" | disconnect |
| 416 | "Range Not Satisfiable" | drop |
| 417 | "Expectation Failed" | disconnect |
| 418 | "I'm a teapot" | disconnect |
| 421 | "Misdirected Request" | disconnect |
| 422 | "Unprocessable Entity" | drop |
| 423 | "Locked" | disconnect |
| 424 | "Failed Dependency" | drop |
| 425 | "Too Early" | drop |
| 426 | "Upgrade Required" | disconnect |
| 428 | "Precondition Required" | retry |
| 429 | "Too Many Requests" | disconnect |
| 431 | "Request Header Fields Too Large" | disconnect |
| 451 | "Unavailable For Legal Reasons" | drop |
| 500 | "Internal Server Error" | disconnect |
| 501 | "Not Implemented" | disconnect |
| 502 | "Bad Gateway" | disconnect |
| 503 | "Service Unavailable" | disconnect |
| 504 | "Gateway Timeout" | retry |
| 505 | "HTTP Version Not Supported" | disconnect |
| 506 | "Variant Also Negotiates" | disconnect |
| 507 | "Insufficient Storage" | disconnect |
| 508 | "Loop Detected" | drop |
| 510 | "Not Extended" | disconnect |
| 511 | "Network Authentication Required" | disconnect |
|------+-----------------------------------+------------|
To customize the action to take for a particular response code, use the arrow operator in the following format: response-action(<response-code> => <action>
. To customize multiple response code-action pairs, separate them with a comma, for example:
http(
url("http://localhost:8080")
response-action(418 => drop, 404 => retry)
);
retries()
Type: | number (of attempts) |
Default: | 3 |
Description: If AxoSyslog cannot send a message, it will try again until the number of attempts reaches retries()
.
If the number of attempts reaches retries()
, AxoSyslog will wait for time-reopen()
time, then tries sending the message again.
To handle HTTP error responses, if the HTTP server returns 5xx codes, AxoSyslog will attempt to resend messages until the number of attempts reaches retries
. If the HTTP server returns 4xx codes, AxoSyslog will drop the messages.
send-time-zone()
Accepted values: | name of the timezone, or the timezone offset |
Default: | local timezone |
Description: Specifies the time zone associated with the messages sent by syslog-ng
, if not specified otherwise in the message or in the destination driver. For details, see Timezones and daylight saving.
The timezone can be specified by using the name, for example, time-zone("Europe/Budapest")
), or as the timezone offset in +/-HH:MM format, for example, +01:00
). On Linux and UNIX platforms, the valid timezone names are listed under the /usr/share/zoneinfo
directory.
ssl-version()
Type: | string |
Default: | None, uses the libcurl default |
Description: Specifies the permitted SSL/TLS version. Possible values: sslv2
, sslv3
, tlsv1
, tlsv1_0
, tlsv1_1
, tlsv1_2
, tlsv1_3
.
An alternative way to specify this option is to put it into a tls()
block, together with any other TLS options. This allows you to separate these options and ensure better readability.
Make sure that you specify TLS options either using their own dedicated option (ca-dir()
, ca-file()
, cert-file()
, cipher-suite()
, key-file()
, peer-verify()
, and ssl-version()
), or using the tls()
block and inserting the relevant options within tls()
. Avoid mixing the two methods. In case you do specify TLS options in both ways, the one that comes later in the configuration file will take effect.
Declaration:
destination d_http {
http(
url("http://127.0.0.1:8080")
tls(
ca-dir("dir")
ca-file("ca")
cert-file("cert")
cipher-suite("cipher")
key-file("key")
peer-verify(yes|no)
ssl-version(<the permitted SSL/TLS version>)
)
);
};
template()
Type: | string |
Default: | A format conforming to the default logfile format. |
Description: Specifies a template defining the logformat to be used in the destination. Macros are described in Macros of AxoSyslog. 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.
throttle()
Type: | number |
Default: | 0 |
Description: 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-reopen()
Accepted values: | number [seconds] |
Default: | 60 |
Description: The time to wait in seconds before a dead connection is reestablished.
timeout()
Type: | number [seconds] |
Default: | 0 |
Description: The value (in seconds) to wait for an operation to complete, and attempt to reconnect the server if exceeded. By default, the timeout value is 0
, meaning that there is no timeout. Available in version 3.11 and later.
time-zone()
Type: | name of the timezone, or the timezone offset |
Default: | unspecified |
Description: 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. Converting the timezone changes the values of all date-related macros derived from the timestamp, for example, HOUR
. For the complete list of such macros, see Date-related macros.
The timezone can be specified by using the name, for example, time-zone("Europe/Budapest")
), or as the timezone offset in +/-HH:MM format, for example, +01:00
). On Linux and UNIX platforms, the valid timezone names are listed under the /usr/share/zoneinfo
directory.
url()
Type: | URL or list of URLs |
Default: | http://localhost/ |
Description: Specifies the hostname or IP address and optionally the port number of the web service that can receive log data via HTTP. Use a colon (:
) after the address to specify the port number of the server. For example: http://127.0.0.1:8000
In case the server on the specified URL returns a redirect request, AxoSyslog automatically follows maximum 3 redirects. Only HTTP and HTTPS based redirections are supported.
Load balancing
Starting with version 3.19, you can specify multiple URLs, for example, url("site1" "site2")
. In this case, AxoSyslog sends log messages to the specified URLs in a load-balance fashion. This means that AxoSyslog sends each message to only one URL. For example, you can use this to send the messages to a set of ingestion nodes or indexers of your SIEM solution if a single node cannot handle the load. Note that the order of the messages as they arrive on the servers can differ from the order AxoSyslog has received them, so use load-balancing only if your server can use the timestamp from the messages. If the server uses the timestamp when it receives the messages, the order of the messages will be incorrect.
url()
option, set the persist-name()
option as well to avoid data loss.
Starting with version AxoSyslog version 3.22, you can use any of the following formats to specify multiple URLs:
url("server1", "server2", "server3"); # comma-separated strings
url("server1" "server2" "server3"); # space-separated strings
url("server1 server2 server3"); # space-separated within a single string
Templates in the url()
Available in AxoSyslog version 4.5.0 and later.
In AxoSyslog, a template can only be resolved on a single message, because the same template might have different resolutions on different messages. As a batch consists of multiple messages, it’s not trivial to decide which message should be used for the resolution.
When batching is enabled and multiple workers are configured, it’s important to add only those messages to a batch which generate identical URLs. To achieve this, set the worker-partition-key()
option with a template that contains all the templates used in the url()
option, otherwise messages will be mixed.
For security reasons, all the templated contents in the url()
option are URL-encoded automatically. The following parts of the URL cannot be templated:
- scheme
- host
- port
- user
- password
user-agent()
Type: | string |
Default: | syslog-ng [version]'/ libcurl[version]` |
Description: The value of the USER-AGENT header in the messages sent to the server.
user()
Type: | string |
Default: |
Description: The username that AxoSyslog uses to authenticate on the server where it sends the messages.
use-system-cert-store()
Type: | yes or no |
Default: | no |
Description: Use the certificate store of the system for verifying HTTPS certificates. For details, see the curl documentation.
worker-partition-key()
Type: | template |
Default: |
Description: The worker-partition-key()
option specifies a template: messages that expand the template to the same value are mapped to the same partition. When batching is enabled and multiple workers are configured, it’s important to add only those messages to a batch which generate identical URLs. To achieve this, set the worker-partition-key()
option with a template that contains all the templates used in the url()
option, otherwise messages will be mixed.
For example, you can partition messages based on the destination host:
worker-partition-key("$HOST")
workers()
Type: | integer |
Default: | 1 |
Description: Specifies the number of worker threads (at least 1) that AxoSyslog uses to send messages to the server. Increasing the number of worker threads can drastically improve the performance of the destination.
Hazard of data loss.
When you use more than one worker threads together with disk-based buffering, AxoSyslog creates a separate disk buffer for each worker thread. This means that decreasing the number of workers can result in losing data currently stored in the disk buffer files. Do not decrease the number of workers when the disk buffer files are in use.
If you are using load-balancing (that is, you have configured multiple servers in the url()
option), increase the number of worker threads at least to the number of servers. For example, if you have set three URLs (url("site1", "site2", "site3")
), set the workers()
option to 3 or more.