Starting with version
The batch-lines(), batch-lines(), and batch-timeout() options of the destination determine how many log messages syslog-ng OSE sends in a batch. The batch-lines() option determines the maximum number of messages syslog-ng OSE puts in a batch in. This can be limited based on size and time:
syslog-ng OSE sends a batch every batch-timeout() milliseconds, even if the number of messages in the batch is less than batch-lines(). That way the destination receives every message in a timely manner even if suddenly there are no more messages.
syslog-ng OSE sends the batch if the total size of the messages in the batch reaches batch-bytes() bytes.
To increase the performance of the destination, increase the number of worker threads for the destination using the workers() option, or adjust the batch-bytes(), batch-lines(), batch-timeout() options.
By default, syslog-ng OSE separates the log messages of the batch with a newline character. You can specify a different delimiter by using the delimiter() option.
If the target application or server requires a special beginning or ending to recognize batches, use the body-prefix() and body-suffix() options to add a beginning and ending to the batch. For example, you can use these options to create JSON-encoded arrays as POST payloads, which is required by a number of REST APIs. The body of a batch HTTP request looks like this:
value of body-prefix() option log-line-1 (as formatted in the body() option) log-line-2 (as formatted in the body() option) .... log-line-n (the number of log lines is batch-lines(), or less if batch-timeout() has elapsed or the batch would be longer than batch-bytes()) value of body-suffix() option
The following destination sends log messages to an Elasticsearch server using the bulk API. A batch consists of 100 messages, or a maximum of 512 kilobytes, and is sent every 10 seconds (10000 milliseconds).
destination d_http { http(url("http://your-elasticsearch-server/_bulk") method("POST") batch-lines(100) batch-bytes(512Kb) batch-timeout(10000) headers("Content-Type: application/x-ndjson") body-suffix("\n") body('{ "index":{} } $(format-json --scope rfc5424 --key ISODATE)') ); };
Starting with version
|
Caution:
If you set multiple URLs in the url() option, set the persist-name() option as well to avoid data loss. |
Starting with version syslog-ng OSE version
url("server1", "server2", "server3"); # comma-separated strings url("server1" "server2" "server3"); # space-separated strings url("server1 server2 server3"); # space-separated within a single string url("server1,server2,server3"); # comma-separated within a single string
The following destination sends log messages to an Elasticsearch server using the bulk API, to 3 different ingest nodes. Each node is assigned a separate worker thread. A batch consists of 100 messages, or a maximum of 512 kilobytes, and is sent every 10 seconds (10000 milliseconds).
destination d_http { http(url("http://your-elasticsearch-server/_bulk" "http://your-second-ingest-node/_bulk" "http://your-third-ingest-node/_bulk") method("POST") batch-lines(100) batch-bytes(512Kb) batch-timeout(10000) workers(3) headers("Content-Type: application/x-ndjson") body-suffix("\n") body('{ "index":{} } $(format-json --scope rfc5424 --key ISODATE)') persist-name("d_http-load-balance") ); };
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.
© 2023 One Identity LLC. ALL RIGHTS RESERVED. Feedback Terms of Use Privacy