Elastic Logging Plugin usage examplesedit

This functionality is experimental and may be changed or removed completely in a future release. Elastic will take a best effort approach to fix any issues, but experimental features 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 Elasticsearchedit

Docker run command:

docker run --log-driver=elastic/elastic-logging-plugin:7.9.1 \
           --log-opt endpoint="myhost:9200" \
           --log-opt user="myusername" \
           --log-opt password="mypassword" \
           -it debian:jessie /bin/bash

Daemon configuration:

{
  "log-driver" : "elastic/elastic-logging-plugin:7.9.1",
  "log-opts" : {
    "endpoint" : "myhost:9200",
    "user" : "myusername",
    "password" : "mypassword",
  }
}

Send Docker logs to Elasticsearch Service on Elastic Cloudedit

Docker run command:

docker run --log-driver=elastic/elastic-logging-plugin:7.9.1 \
           --log-opt cloud_id="MyElasticStack:daMbY2VudHJhbDekZ2NwLmN4b3VkLmVzLmliJDVkYmQwtGJiYjs0NTRiN4Q5ODJmNGUwm1IxZmFkNjM5JDFiNjdkMDE4MTgxMTQzNTM5ZGFiYWJjZmY0OWIyYWE5" \
           --log-opt cloud_auth="myusername:mypassword" \
           -it debian:jessie /bin/bash

Daemon configuration:

{
  "log-driver" : "elastic/elastic-logging-plugin:7.9.1",
  "log-opts" : {
    "cloud_id" : "MyElasticStack:daMbY2VudHJhbDekZ2NwLmN4b3VkLmVzLmliJDVkYmQwtGJiYjs0NTRiN4Q5ODJmNGUwm1IxZmFkNjM5JDFiNjdkMDE4MTgxMTQzNTM5ZGFiYWJjZmY0OWIyYWE5",
    "cloud_auth" : "myusername:mypassword",
    "output.elasticsearch.index" : "elastic-log-driver-%{+yyyy.MM.dd}"
  }
}

Specify a custom index and templateedit

Docker run command:

docker run --log-driver=elastic/elastic-logging-plugin:7.9.1 \
           --log-opt endpoint="myhost:9200" \
           --log-opt user="myusername" \
           --log-opt password="mypassword" \
           --log-opt index="eld-%{[agent.version]}-%{+yyyy.MM.dd}" \
           -it debian:jessie /bin/bash

Daemon configuration:

{
  "log-driver" : "elastic/elastic-logging-plugin:7.9.1",
  "log-opts" : {
    "endpoint" : "myhost:9200",
    "user" : "myusername",
    "index" : "eld-%{[agent.version]}-%{+yyyy.MM.dd}",
    "password" : "mypassword",
  }
}