Where do logs go when running in docker?

I’m using docker-compose to start gladys and watchtower. Using docker logs I can see the most recent logs. Are they actually persisted anywhere? I have a volume mapped for /var/lib/gladysassistant but don’t see any logs in there.

Hello. They are not by default.

Is there some other volume I can map to the host?

I can’t work out where they are written to.

Hi, there is no log file inside container ( console mode ), but docker daemon store the log in your host

/var/lib/docker/containers/<container id>/<container id>-json.log

If you need container id you can run this command

docker inspect --format="{{.Id}}" gladys

Thanks. So they go when the container is deleted. Is there a way to have gladys log to /var/lib/gladysassistant instead?

No you can’t , it’s not really related to Gladys but with docker engine.

You can tweak as you need your compose file

Thanks!

I guess it becomes a docker engine thing when one decides to log everything to the console :slight_smile:

1 Like