IMPORTANT: No additional bug fixes or documentation updates
will be released for this version. For the latest information, see the
current release documentation.
Docker Provider
editDocker Provider
editProvides inventory information from Docker. The available keys are:
Key | Type | Description |
---|---|---|
|
|
ID of the container |
|
|
Arg path of container |
|
|
Name of the container |
|
|
Image of the container |
|
|
Labels of the container |
|
|
Ports of the container |
|
|
Object of paths for the container |
|
|
Log path of the container |
For example, the Docker provider provides the following inventory:
[ { "id": "1", "mapping:": {"id": "1", "paths": {"log": "/var/log/containers/1.log"}}, "processors": {"add_fields": {"container.name": "my-container"}} }, { "id": "2", "mapping": {"id": "2", "paths": {"log": "/var/log/containers/2.log"}}, "processors": {"add_fields": {"container.name": "other-container"}} } ]
Elastic Agent automatically prefixes the result with docker
:
--- [ {"docker": {"id": "1", "paths": {"log": "/var/log/containers/1.log"}}}, {"docker": {"id": "2", "paths": {"log": "/var/log/containers/2.log"}}, ] ---
To set the log path dynamically in the configuration, use a variable in the Elastic Agent policy to return path information from the provider:
inputs: - type: logfile path: "${docker.paths.log}"
The policy generated by this configuration looks like:
inputs: - type: logfile path: "/var/log/containers/1.log" processors: - add_fields: container.name: my-container - type: logfile path: "/var/log/containers/2.log" processors: - add_fields: container.name: other-container