How to configure docker to write logs to a folder named container?

Hello.

By default, the docker logs
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
821dcb7bb9cb prakhar1989/static-site "./wrapper.sh" 2 days ago Up 2 days 0.0.0.0:32773->80/tcp, 0.0.0.0:32772->443/tcp static-site

get in
/var/lib/docker/containers/821dcb7bb9cb7587c4806bbbeb1357052a5d9fcb05a5aa3f09821e07fa402d40/


Is it possible to configure the upload log so that it logs in your named docker name in my case static-site?
March 23rd 20 at 19:24
2 answers
March 23rd 20 at 19:26
Output via syslog where you want, the "why" question is open.
I send them with ELK, made a General index (no desire to produce under each of your docker index) then plan to make charts response codes, broken down not just by the host, and the containers, BUT when I send the logs to the naming container for the id, I only see the Container ID, I would like to understand which of them went the problem by name. Was able to answer the question Why? ) - Jakob.Reinger commented on March 23rd 20 at 19:29
@Jakob.Reinger, s/s ELK/ELK/
In filebeat has a built-in processor add_docker_metadata: ~, the container name will be in the field of docker.container.name, do not like Logstash/Ingest rename to help. - Brad_Bogisi commented on March 23rd 20 at 19:32
March 23rd 20 at 19:28
You probably need to learn to read the container name, quite simply:
docker logs-name container # just to see the logs
docker logs -f name-container # in realtim mode


You can also configure logging in applications where the flight of imagination is not limited, but don't forget about the rotation, the logs can consume the entire disk.

Find more questions by tags Docker