Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logs are not forwarded to STDOUT until nginx-log-forwarder is restarted (phusion/passenger-ruby25:0.9.34) #224

Open
thepry opened this issue Jul 2, 2018 · 4 comments

Comments

@thepry
Copy link

thepry commented Jul 2, 2018

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
@ztrange
Copy link

ztrange commented Jul 24, 2019

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

@orangewolf
Copy link

@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.

@rokolabrovic
Copy link

Confirming that adding RUN rm -f /var/log/nginx/error.log to Dockerfile solved the issue.

CamJN added a commit that referenced this issue Apr 23, 2024
per suggestions in #224
@CamJN
Copy link
Member

CamJN commented Apr 26, 2024

I pre-delete /var/log/nginx/error.log in the new image, does that help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants