Hi, I use a Node/Express service on render. I want to log my HTTP traffic with “morgan”. I’ve got issues with choosing the right location for the logfile. I can’t put it in /opt/render or any subfolder because the entire /opt/render is being deleted when the latest commit is pulled. So the logfile is lost if I don’t save it before pushing. I can’t put it in a folder above /opt/render like /var/log either because I don’t have the permissions to do so. At least I get an Error: EROFS: read-only file system, open ‘/var/log/access.log’. Where can I put the logfile? Thanks!
Hi @tom,
Since Render services are run as Docker containers, their filesystem is ephemeral by default and will, as you’ve noticed, be reset with every new deploy. If you need to have a persistent file system, you can attach a persistent disk to your service. Check out our Disks for more information.
Another option for logging that is popular is to send your logs to an external system. With Render, the easiest solution is to send your logs to LogDNA by creating a LogDNA addon at https://dashboard.render.com/addon/details/logdna. Your logs will be automatically sent to LogDNA, and the length of log persistence is customizable by choosing different plans.
1 Like