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!
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 like fluentd
or Papertrail
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:
https://docs.digitalocean.com/products/app-platform/how-to/forward-logs/
- Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.