mskm
mskm

Reputation: 37

How to organize container logs . Can the default container log location be changed?

In Linux, the Docker containers log files are in location :

/var/lib/docker/containers/<container-id>/<container-id>-json.log
  1. can this default path "/var/lib/docker/containers/" be changed and how?
  2. the default container logs are organised with container id, can this be changed to container name. in my project case every-time a docker image for a particular container changes(upgrades to a newer version) . a new container is spun up and log name changes but the container name remains same hence logging with container name helps. is my understanding correct ? I know that with logging driver we can append the container name to logs and then segregate it later.
  3. docker container logs gives out logs which are written to STDOUT. if my container app doesn't put out logs to STDOUT instead uses logging solution like log4j and logs it to a different location,
docker logs <container_id> 

might not return actual container/app log ? is my understanding correct?

Upvotes: 0

Views: 191

Answers (1)

Gokul C
Gokul C

Reputation: 151

Better solution would be to use fluentbit and push thelogs to elasticsearch.

Upvotes: 1

Related Questions