The http destination of syslog-ng OSE can directly post log messages to web services using the HTTP protocol. The http destination has the following options.
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, syslog-ng OSE 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, syslog-ng OSE flushes the messages only if batch-timeout() expires, or the batch reaches the limit set in batch-bytes().
Available in syslog-ng OSE version
For details on how this option influences HTTP batch mode, see http: Posting messages over HTTP without Java
Type: | number |
Default: | 1 |
Description: Specifies how many lines are flushed to a destination in one batch. The syslog-ng OSE 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, syslog-ng OSE waits for 100 messages.
If the batch-timeout() option is disabled, the syslog-ng OSE application flushes the messages if it has sent batch-lines() number of messages, or the queue became empty. If you stop or reload syslog-ng OSE or in case of network sources, the connection with the client is closed, syslog-ng OSE automatically sends the unsent messages to the destination.
Note that if the batch-timeout() option is enabled and the queue becomes empty, syslog-ng OSE 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 syslog-ng OSE 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.
For details on how this option influences HTTP batch mode, see http: Posting messages over HTTP without Java
Type: | time in milliseconds |
Default: | -1 (disabled) |
Description: Specifies the time syslog-ng OSE waits for lines to accumulate in the output buffer. The syslog-ng OSE application sends batches to the destinations evenly. The timer starts when the first message arrives to the buffer, so if only few messages arrive, syslog-ng OSE 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
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.
Accepted values: | string |
Default: | none |
Description: The string syslog-ng OSE puts at the beginning of the body of the HTTP request, before the log message. Available in syslog-ng OSE version
For details on how this option influences HTTP batch mode, see http: Posting messages over HTTP without Java
Accepted values: | string |
Default: | none |
Description: The string syslog-ng OSE puts to the end of the body of the HTTP request, after the log message. Available in syslog-ng OSE version
For details on how this option influences HTTP batch mode, see http: Posting messages over HTTP without Java
Accepted values: | Directory name |
Default: | none |
Description: 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 syslog-ng clients. The syslog-ng OSE application uses the CA certificates in this directory to validate the certificate of the peer.
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.
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>) ) ); };
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 syslog-ng OSE 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.
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>) ) ); };
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 syslog-ng OSE application uses this certificate to authenticate the syslog-ng OSE 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.
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>) ) ); };
Accepted values: | Name of a cipher, or a colon-separated list |
Default: | Depends on the OpenSSL version that syslog-ng OSE 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 syslog-ng OSE. 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
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.
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>) ) ); };
Accepted values: | string |
Default: | newline character |
Description: 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. Available in syslog-ng OSE version
For details on how this option influences HTTP batch mode, see http: Posting messages over HTTP without Java
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:
reliable() | |||
Type: | yes|no | ||
Default: | no | ||
Description: If set to yes, syslog-ng OSE cannot lose logs in case of reload/restart, unreachable destination or syslog-ng OSE 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.
|
disk-buf-size() | |
Type: | number (bytes) |
Default: | |
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. |
mem-buf-length() | |
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. |
mem-buf-size() | |
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. |
qout-size() | |
Type: | number (messages) |
Default: | 64 |
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 disk-buf-size() are required options.
In the following case reliable disk-buffer() is used.
destination d_demo { network( "127.0.0.1" port(3333) disk-buffer( mem-buf-size(10000) disk-buf-size(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( mem-buf-length(10000) disk-buf-size(2000000) reliable(no) dir("/tmp/disk-buffer") ) ); };
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>
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.
NOTE: The syslog-ng OSE application must be able to start and restart the external program, and have the necessary permissions to do so. For example, if your host is running AppArmor or SELinux, you might have to modify your AppArmor or SELinux configuration to enable syslog-ng OSE to execute external applications.
To execute an external program when syslog-ng OSE starts or stops, use the following options:
startup() | |
Type: | string |
Default: | N/A |
Description: Defines the external program that is executed as syslog-ng OSE starts. |
shutdown() | |
Type: | string |
Default: | N/A |
Description: Defines the external program that is executed as syslog-ng OSE stops. |
To execute an external program when the syslog-ng OSE configuration is initiated or torn down, for example, on startup/shutdown or during a syslog-ng OSE reload, use the following options:
setup() | |
Type: | string |
Default: | N/A |
Description: Defines an external program that is executed when the syslog-ng OSE configuration is initiated, for example, on startup or during a syslog-ng OSE reload. |
teardown() | |
Type: | string |
Default: | N/A |
Description: Defines an external program that is executed when the syslog-ng OSE configuration is stopped or torn down, for example, on shutdown or during a syslog-ng OSE reload. |
In the following example, the hook-commands() is used with the network() driver and it opens an iptables port automatically as syslog-ng OSE 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 syslog-ng OSE 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") ) ); };
Type: | number |
Default: | Use global setting. |
Description: The number of messages that the output queue can store.
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 syslog-ng OSE application uses this private key and the matching certificate (set in the cert-file() option) to authenticate the syslog-ng OSE 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.
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>) ) ); };
Type: | POST | PUT |
Default: | POST |
Description: Specifies the HTTP method to use when sending the message to the server.
Type: | string |
Default: |
Description: The password that syslog-ng OSE uses to authenticate on the server where it sends the messages.
Accepted values: | yes | 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 — syslog-ng accepts the certificate even if it is expired, signed by an unknown CA, or its CN and the name of the machine mismatches.
|
Caution:
When validating a certificate, the entire certificate chain must be valid, including the CA certificate. If any certificate of the chain is invalid, syslog-ng OSE will reject the connection. |
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.
Type: | string |
Default: |
Description:If you receive the following error message during syslog-ng OSE 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").
Type: | list |
Default: | N/A (see below) |
Description: Specifies what syslog-ng OSE 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), syslog-ng OSE 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), syslog-ng OSE assumes the message was successfully sent. For other status codes, syslog-ng OSE 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 of retries() 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 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) );
Type: | number (of attempts) |
Default: | 3 |
Description: The number of times syslog-ng OSE attempts to send a message to this destination. If syslog-ng OSE could not send a message, it will try again until the number of attempts reaches retries, then drops the message.
To handle HTTP error responses, if the HTTP server returns 5xx codes, syslog-ng OSE will attempt to resend messages until the number of attempts reaches retries. If the HTTP server returns 4xx codes, syslog-ng OSE will drop the messages.
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.
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.
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>) ) ); };
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 syslog-ng OSE. 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.
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.
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
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, syslog-ng OSE automatically follows maximum 3 redirects. Only HTTP and HTTPS based redirections are supported.
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
Type: | string |
Default: | syslog-ng [version]/libcurl[version] |
Description: The value of the USER-AGENT header in the messages sent to the server.
Type: | string |
Default: |
Description: The username that syslog-ng OSE uses to authenticate on the server where it sends the messages.
Type: | yes | no |
Default: | no |
Description: Use the certificate store of the system for verifying HTTPS certificates. For details, see the curl documentation.
Type: | integer |
Default: | 1 |
Description: Specifies the number of worker threads (at least 1) that syslog-ng OSE uses to send messages to the server. Increasing the number of worker threads can drastically improve the performance of the destination.
|
Caution:
Hazard of data loss. When you use more than one worker threads together with disk-based buffering, syslog-ng OSE 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.
Starting with version
This destination is only supported on the Linux platform.
Since syslog-ng OSE uses the official Java Kafka producer, the kafka destination has significant memory usage.
The log messages of the underlying client libraries are available in the internal() source of syslog-ng OSE.
@module mod-java @include "scl.conf" kafka( client-lib-dir("/opt/syslog-ng/lib/syslog-ng/java-modules/:<path-to-preinstalled-kafka-libraries>") kafka-bootstrap-servers("1.2.3.4:9092,192.168.0.2:9092") topic("${HOST}") );
The following example defines a kafka destination, using only the required parameters.
@module mod-java @include "scl.conf" destination d_kafka { kafka( client-lib-dir("/opt/syslog-ng/lib/syslog-ng/java-modules/KafkaDestination.jar:/usr/share/kafka/lib/") kafka-bootstrap-servers("1.2.3.4:9092,192.168.0.2:9092") topic("${HOST}") ); };
To install the software required for the kafka destination, see Prerequisites.
For details on how the kafka destination works, see How syslog-ng OSE interacts with Apache Kafka.
For the list of options, see Kafka destination options.
The kafka() driver is actually a reusable configuration snippet configured to receive log messages using the Java language-binding of syslog-ng OSE. For details on using or writing such configuration snippets, see Reusing configuration blocks. You can find the source of the kafka configuration snippet on GitHub. For details on extending syslog-ng OSE in Java, see the Getting started with syslog-ng development guide.
If you delete all Java destinations from your configuration and reload syslog-ng, the JVM is not used anymore, but it is still running. If you want to stop JVM, stop syslog-ng and then start syslog-ng again.
To publish messages from syslog-ng OSE to Apache Kafka, complete the following steps.
If you want to use the Java-based modules of syslog-ng OSE (for example, the Elasticsearch, HDFS, or Kafka destinations), you must compile syslog-ng OSE with Java support.
Download and install the Java Runtime Environment (JRE), 1.7 (or newer).
Install gradle version 2.2.1 or newer.
Set LD_LIBRARY_PATH to include the libjvm.so file, for example:LD_LIBRARY_PATH=/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/server:$LD_LIBRARY_PATH
Note that many platforms have a simplified links for Java libraries. Use the simplified path if available. If you use a startup script to start syslog-ng OSE set LD_LIBRARY_PATH in the script as well.
If you are behind an HTTP proxy, create a gradle.properties under the modules/java-modules/ directory. Set the proxy parameters in the file. For details, see The Gradle User Guide.
Download the latest stable binary release of the Apache Kafka libraries (version 0.9 or newer) from http://kafka.apache.org/downloads.html.
Extract the Apache Kafka libraries into a single directory. If needed, collect the various .jar files into a single directory (for example, /opt/kafka/lib/) where syslog-ng OSE can access them. You must specify this directory in the syslog-ng OSE configuration file.
Check if the following files in the Kafka libraries have the same version number: slf4j-api-<version-number>.jar, slf4j-log4j12-<version-number>.jar. If the version number of these files is different, complete the following steps:
Delete one of the files (for example, slf4j-log4j12-<version-number>.jar).
Download a version that matches the version number of the other file (for example, 1.7.6) from the official SLF4J distribution.
Copy the downloaded file into the directory of your Kafka library files (for example, /opt/kafka/lib/).
When stopping the syslog-ng OSE application, syslog-ng OSE will not stop until all Java threads are finished, including the threads started by the Kafka Producer. There is no way (except for the kill -9 command) to stop syslog-ng OSE before the Kafka Producer stops. To change this behavior set the properties of the Kafka Producer in its properties file, and reference the file in the properties-file option.
The syslog-ng OSE kafka destination tries to reconnect to the brokers in a tight loop. This can look as spinning, because of a lot of similar debug messages. To decrease the amount of such messages, set a bigger timeout using the following properties:
retry.backoff.ms=1000 reconnect.backoff.ms=1000
For details on using property files, see properties-file(). For details on the properties that you can set in the property file, see the Apache Kafka documentation.
© ALL RIGHTS RESERVED. 利用規約 プライバシー Cookie Preference Center