Install and configure the Elastic Logging Pluginedit

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.

Before you beginedit

Make sure your system meets the following prerequisites:

  • Docker: Engine API 1.25 or later
  • Elastic Stack: Version 7.6.0 or later

Step 1: Install the Elastic Logging Plugin pluginedit

  1. Install the plugin. You can install it from the Docker store (recommended), or build and install the plugin from source in the beats GitHub repo.

    To install from the Docker store:

    docker plugin install elastic/elastic-logging-plugin:7.8.0

    To build and install from source:

    Set up your development environment as described in the Beats Developer Guide then run:

    cd x-pack/dockerlogbeat
    mage BuildAndInstall
  2. If necessary, enable the plugin:

    docker plugin enable elastic/elastic-logging-plugin:7.8.0
  3. Verify that the plugin is installed and enabled:

    docker plugin ls

    The output should say something like:

    ID                  NAME                                   DESCRIPTION              ENABLED
    c2ff9d2cf090        elastic/elastic-logging-plugin:7.8.0   A beat for docker logs   true

Step 2: Configure the Elastic Logging Pluginedit

You can set configuration options for a single container, or for all containers running on the host. See Configuration options for a list of supported configuration options.

To configure a single container:

Pass configuration options at run time when you start the container. For example:

docker run --log-driver=elastic/elastic-logging-plugin:7.8.0 \
           --log-opt output.elasticsearch.hosts="https://myhost:9200" \
           --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

To configure all containers running on the host:

Set configuration options in the Docker daemon.json configuration file. For example:

{
  "log-driver" : "elastic/elastic-logging-plugin:7.8.0",
  "log-opts" : {
    "output.elasticsearch.hosts" : "https://myhost:9200",
    "output.elasticsearch.username" : "myusername",
    "output.elasticsearch.password" : "mypassword",
    "output.elasticsearch.index" : "elastic-log-driver-%{+yyyy.MM.dd}"
  }
}

The default location of the daemon.json file varies by platform. On Linux, the default location is /etc/docker/daemon.json. For more information, see the Docker docs.