Install and configure the Elastic Logging Plugin

edit

Install and configure the Elastic Logging Plugin

edit

Before you begin

edit

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 plugin

edit
  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:8.15.3

    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:8.15.3
  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:8.15.3   A beat for docker logs   true

Step 2: Configure the Elastic Logging Plugin

edit

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:8.15.3 \
           --log-opt hosts="https://myhost:9200" \
           --log-opt user="myusername" \
           --log-opt password="mypassword" \
           -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:8.15.3",
  "log-opts" : {
    "hosts" : "https://myhost:9200",
    "user" : "myusername",
    "password" : "mypassword"
  }
}

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.