A newer version is available. For the latest information, see the
current release documentation.
Elastic Logging Plugin usage examples
editElastic Logging Plugin usage examples
editThis functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.
The following examples show common configurations for the Elastic Logging Plugin.
Send Docker logs to Elasticsearch
editDocker run command:
docker run --log-driver=elastic/elastic-logging-plugin:7.7.1 \ --log-opt output.elasticsearch.hosts="myhost:9200" \ --log-opt output.elasticsearch.protocol="https" \ --log-opt output.elasticsearch.username="myusername" \ --log-opt output.elasticsearch.password="mypassword" \ --log-opt output.elasticsearch.index="elastic-log-driver-%{+yyyy.MM.dd}" \ -it debian:jessie /bin/bash
Daemon configuration:
{ "log-driver" : "elastic/elastic-logging-plugin:7.7.1", "log-opts" : { "output.elasticsearch.hosts" : "myhost:9200", "output.elasticsearch.protocol" : "https", "output.elasticsearch.username" : "myusername", "output.elasticsearch.password" : "mypassword", "output.elasticsearch.index" : "elastic-log-driver-%{+yyyy.MM.dd}" } }
Send Docker logs to Elasticsearch Service on Elastic Cloud
editDocker run command:
docker run --log-driver=elastic/elastic-logging-plugin:7.7.1 \ --log-opt cloud.id="MyElasticStack:daMbY2VudHJhbDekZ2NwLmN4b3VkLmVzLmliJDVkYmQwtGJiYjs0NTRiN4Q5ODJmNGUwm1IxZmFkNjM5JDFiNjdkMDE4MTgxMTQzNTM5ZGFiYWJjZmY0OWIyYWE5" \ --log-opt cloud.auth="myusername:mypassword" \ --log-opt output.elasticsearch.index="elastic-log-driver-%{+yyyy.MM.dd}" \ -it debian:jessie /bin/bash
Daemon configuration:
{ "log-driver" : "elastic/elastic-logging-plugin:7.7.1", "log-opts" : { "cloud.id" : "MyElasticStack:daMbY2VudHJhbDekZ2NwLmN4b3VkLmVzLmliJDVkYmQwtGJiYjs0NTRiN4Q5ODJmNGUwm1IxZmFkNjM5JDFiNjdkMDE4MTgxMTQzNTM5ZGFiYWJjZmY0OWIyYWE5", "cloud.auth" : "myusername:mypassword", "output.elasticsearch.index" : "elastic-log-driver-%{+yyyy.MM.dd}" } }
Send Docker logs to Logstash
editDocker run command:
docker run --log-driver=elastic/elastic-logging-plugin:7.7.1 \ --log-opt output.logstash.hosts="myhost:5044" \ -it debian:jessie /bin/bash
Daemon configuration:
{ "log-driver" : "elastic/elastic-logging-plugin:7.7.1", "log-opts" : { "output.logstash.hosts" : "myhost:5044" } }