Version
HTTPS connection, as well as password- and certificate-based authentication is supported. The content of the events is sent in JSON format.
NOTE: Typically, only the central syslog-ng PE server uses this destination. For more information on the server mode, see Server mode.
Declaration
d_elasticsearch_http {
elasticsearch-http(
index("<elasticsearch-index-to-store-messages>")
url("https://your-elasticsearch-server1:9200/_bulk" "https://your-elasticsearch-server2:9200/_bulk")
type("<type-of-the-index>")
);
};Example: Sending log data to Elasticsearch
The following example defines a elasticsearch-http() destination, with only the required options.
destination d_elasticsearch_http {
elasticsearch-http(
index("<name-of-the-index>")
type("<type-of-the-index>")
url("http://my-elastic-server:9200/_bulk")
);
};
log {
source(s_file);
destination(d_elasticsearch_http);
flags(flow-control);
};
The following example uses mutually-authenticated HTTPS connection, templated index, and also sets the type() and some other options.
destination d_elasticsearch_https {
elasticsearch-http(
url("https://node01.example.com:9200/_bulk")
index("test-${YEAR}${MONTH}${DAY}")
time-zone("UTC")
type("test")
workers(4)
batch-lines(16)
timeout(10)
tls(
ca-file("ca.pem")
cert-file("syslog_ng.crt.pem")
key-file("syslog_ng.key.pem")
peer-verify(yes)
)
);
};This driver is actually a reusable configuration snippet configured to send log messages using the tcp() driver using a template. For details on using or writing such configuration snippets, see Reusing configuration blocks. You can find the source of this configuration snippet on GitHub.