I’m running a few containers on a DigitalOcean Droplet and using docker logs
to check output.
The issue is that logs disappear when containers are restarted. What’s the best way to persist logs or send them somewhere reliable so I don’t lose them after restarts or reboots?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hey there 👋
By default, Docker uses the
json-file
logging driver, which stores logs locally, but they can get wiped on container restart depending on your settings.To persist logs, you can:
Mount a volume to
/var/lib/docker/containers
(not ideal)Use a logging driver like
syslog
,journald
, or a remote option likefluentd
orPapertrail
Or redirect logs inside your app to a mounted volume or external service
If you’re using App Platform, you can also forward logs to Papertrail directly from the dashboard:
- Bobby