mirror of
https://github.com/ansible-collections/community.docker.git
synced 2026-07-29 11:55:04 +00:00
Support getting container output from local logging driver (#337)
The `local` [Docker logging driver](https://docs.docker.com/config/containers/logging/local/) is a new-ish, optimized local logging driver that improves upon json-file. Since logs written using `local` can still be accessed through the Docker daemon API, all that is needed here is to add to the supported list.
This commit is contained in:
@@ -643,7 +643,7 @@ options:
|
||||
output_logs:
|
||||
description:
|
||||
- If set to true, output of the container command will be printed.
|
||||
- Only effective when I(log_driver) is set to C(json-file) or C(journald).
|
||||
- Only effective when I(log_driver) is set to C(json-file), C(journald), or C(local).
|
||||
type: bool
|
||||
default: no
|
||||
paused:
|
||||
@@ -3142,7 +3142,7 @@ class ContainerManager(DockerBaseClass):
|
||||
config = self.client.inspect_container(container_id)
|
||||
logging_driver = config['HostConfig']['LogConfig']['Type']
|
||||
|
||||
if logging_driver in ('json-file', 'journald'):
|
||||
if logging_driver in ('json-file', 'journald', 'local'):
|
||||
output = self.client.logs(container_id, stdout=True, stderr=True, stream=False, timestamps=False)
|
||||
if self.parameters.output_logs:
|
||||
self._output_logs(msg=output)
|
||||
|
||||
Reference in New Issue
Block a user