passenger-docker
passenger-docker copied to clipboard
Logs are not forwarded to STDOUT until nginx-log-forwarder is restarted (phusion/passenger-ruby25:0.9.34)
UPDATE: Adding RUN rm -f /var/log/nginx/error.log to my Docker file helped with this issue. I'm not sure why, maybe it's some weird bug with nginx-log-forwarder service and error.log file.
....
Hi. I'm using phusion/passenger-ruby25:0.9.34 with Rails. Rails are using STDOUT as log destination, but the log doesn't appear in the docker logs, even though it is present in /var/log/nginx/error.log
If I run docker exec backend sv restart nginx-log-forwarder it appears.
Do you have any idea how to fix this problem?
What does your software stack look like?
Nginx + passenger + rails 5.1.4
What operating system and processor architecture are you using?
ubuntu EC2 (couldn't reproduce on my mac)
What did you do? 😱
nothing :)
What did you expect to see?
New Logs appear in the STDOUT
What did you see instead?
Only initial log:
*** Running /etc/my_init.d/00_regen_ssh_host_keys.sh...
*** Running /etc/my_init.d/10_syslog-ng.init...
Jul 2 16:45:26 5056e3a95c28 syslog-ng[10]: syslog-ng starting up; version='3.5.6'
Jul 2 16:45:27 5056e3a95c28 syslog-ng[10]: EOF on control channel, closing connection;
*** Running /etc/my_init.d/30_presetup_nginx.sh...
*** Running /etc/rc.local...
*** Booting runit daemon...
*** Runit started as PID 17
Jul 2 16:45:27 5056e3a95c28 cron[24]: (CRON) INFO (pidfile fd = 3)
Jul 2 16:45:27 5056e3a95c28 cron[24]: (CRON) INFO (Running @reboot jobs)
ok: run: /etc/service/nginx-log-forwarder: (pid 26) 1s
Do you still need this workaround after updating to v1.0.6 ? It fixes some issue with log rotation that may be the cause of this
@ztrange ran in to this issue on 1.0.9. Adding the RUN rm -f /var/log/nginx/error.log to Dockerfile fixed it for us. We do have a 2 stage build (a Dockerfile.base which inherits FROM phusion/passenger-ruby26:1.0.9 and a Dockerfile which inherits from that, but we've had that set up for a while and the logs have worked in the past. We did make some Dockerfile changes and just changed from Rancher1 (Cattle based) to Rancher2 (K8S based) for our deployment. Somewhere between those 2 sets of things, this issue cropped up.
Confirming that adding RUN rm -f /var/log/nginx/error.log to Dockerfile solved the issue.
I pre-delete /var/log/nginx/error.log in the new image, does that help?