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


By default, the docker logs
821dcb7bb9cb prakhar1989/static-site "./" 2 days ago Up 2 days>80/tcp,>443/tcp static-site

get in

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, 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