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

no Phusion Passenger(R) log file configured, discarding log output #2541

Open
hariapollo opened this issue May 9, 2024 · 11 comments
Open

no Phusion Passenger(R) log file configured, discarding log output #2541

hariapollo opened this issue May 9, 2024 · 11 comments

Comments

@hariapollo
Copy link

hariapollo commented May 9, 2024

We are encountering the issue with log output to the container for passenger. This is the logs which shows when we do kubectl logs -f pod
[alert] 7#7: no Phusion Passenger(R) log file configured, discarding log output

Installed packages:
passenger verison: 6.0.20
nginx - 1.22.1
Os version - debian 12 (bookworm)
Installation details - https://www.phusionpassenger.com/docs/advanced_guides/install_and_upgrade/standalone/install/oss/bookworm.html

We've also tried to move nginx 1.22.1 from 1.24.0 as suggested by the passenger changelog though its giving trouble with package dependency.

We tried to install passenger and nginx using below.

apt-get update && apt-get install -y dirmngr gnupg apt-transport-https ca-certificates curl && \
curl https://oss-binaries.phusionpassenger.com/auto-software-signing-gpg-key.txt | gpg --dearmor | tee /etc/apt/trusted.gpg.d/phusion.gpg >/dev/null && \
sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger bookworm main > /etc/apt/sources.list.d/passenger.list' && \
apt-get update && \
apt-get install -y passenger libnginx-mod-http-passenger=1:6.0.20-1~bookworm1

apt-get update && \
apt-get -y install lsb-release ca-certificates curl && \
curl -sSLo /tmp/debsuryorg-archive-keyring.deb https://packages.sury.org/debsuryorg-archive-keyring.deb && \
dpkg -i /tmp/debsuryorg-archive-keyring.deb && \
sh -c 'echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-nginx.gpg] https://packages.sury.org/nginx/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/nginx.list' && \
apt-get update && apt install nginx -y && apt install nginx-extras -y 

Installation error:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libnginx-mod-http-passenger : Depends: nginx-common (< 1.22.2) but 1.24.0-4+0~20240320.34+debian12~1.gbp7180f0 is to be installed
E: Unable to correct problems, you have held broken packages.
@hariapollo hariapollo changed the title [alert] 7#7: no Phusion Passenger(R) log file configured, discarding log output no Phusion Passenger(R) log file configured, discarding log output May 9, 2024
@CamJN
Copy link
Contributor

CamJN commented May 9, 2024

You cannot use modules compiled for one nginx version with another nginx version. Our nginx module package is compiled for the distro nginx not the one provided by f5. If you want to use an nginx other than the distro provided package, you need to compile the passenger module yourself. there are instructions here: https://www.phusionpassenger.com/docs/advanced_guides/install_and_upgrade/nginx/install_as_nginx_module.html

As for the log output, by default logs are added to the nginx error log, which you can tail to stdout with a simple script like our docker images do. I'm not actually sure where the error you see is coming from.

@hariapollo
Copy link
Author

hariapollo commented May 10, 2024

Okay, the error is written over here

"no " PROGRAM_NAME " log file configured, discarding log output");

As for the log output, by default logs are added to the nginx error log, which you can tail to stdout with a simple script like our docker images do

Yes i do the same from the dockerfile though its not sending any logs here and the /dev/stdout and /dev/stderr are empty when i do tail of them

RUN ln -sf /dev/stdout /var/log/nginx/access.log \
  && ln -sf /dev/stderr /var/log/nginx/error.log
root@rails-api-6dd74cccd8-858k9:/home/app/webapp# tail -f /dev/stderr
^C
root@rails-api-6dd74cccd8-858k9:/home/app/webapp# tail -f /dev/stdout
^C
root@rails-api-6dd74cccd8-858k9:/home/app/webapp# nginx -v
nginx version: nginx/1.22.1

Is passenger version >= 6.0.18 is not compiled with nginx 1.24.0 version? as i can see in changelog it is suggested that we need to upgrade to 1.24.0 from 1.22.1 version.

and is there anything changed for the latest version of passenger for the logs config?. Per doc the log would written to /var/log/nginx/access.log and /var/log/nginx/error.log.

@CamJN
Copy link
Contributor

CamJN commented May 10, 2024

Passenger standalone (ie running passenger start) uses its own internal nginx 1.24.0 as per the change log. But you seem to want to use the nginx integration, which has nginx start passenger. That integration uses the nginx version available from the distro's repo.

That no logs are currently being forwarded makes no sense because nginx itself should be producing some logs at least. I'd recommend getting nginx configured to log how you like first, then try turning passenger back on.

@hariapollo
Copy link
Author

hariapollo commented May 10, 2024

Hi @CamJN,

I've tried with debian 11 (bullseye) docker image and latest passenger version 6.0.20 and by default nginx version installed in here is 1.18.0 and its showing logs when i do kubectl logs -f pod.

It is only giving issue with debian 12(bookworm) with passenger version 6.0.20 and nginx version 1.22.1 is not working. Is there any idea why it is failing?. seems it might be due to nginx but i am following the passenger doc to install same on ruby image 3.3.1-slim.

Would you please suggest here?

@CamJN
Copy link
Contributor

CamJN commented May 13, 2024

I would recommend getting it working without passenger, then turn passenger on.

@md5
Copy link

md5 commented Aug 6, 2024

@CamJN what is it you're suggesting should be working without passenger?

We're seeing this same behavior with bookworm and in our case, we are seeing Nginx access logging and the "alert" message in the original report, but not the application log output. We have a similar scenario to the Dockerfile snippet above, where the Docker image is based on ruby-3.3.4-slim-bookworm and we are symlinking /var/log/nginx/access.log to /dev/stdout and /var/log/nginx/error.log to /dev/stderr. I have not tried to do anything to trigger Nginx itself to write to its error_log, but we have error_log /var/log/nginx/error.log in the http block. It seems the symlinking of access.log and error.log is a key difference from how the passenger-docker image is functioning, which is using tail -F to watch an actual error.log file and sending it to the container stdout.

It seems that this scenario is arising when nothing is being set for "path" in j_log_target in this block of code:

if (autogenerated_main_conf->log_file.len > 0) {
psg_json_value_set_ngx_str_ne(j_log_target, "path", &autogenerated_main_conf->log_file);
} else if (cycle->new_log.file == NULL) {
ngx_log_error(NGX_LOG_EMERG, cycle->log, 0, "Cannot initialize " PROGRAM_NAME
" because Nginx is not configured with an error log file."
" Please either configure Nginx with an error log file, or configure "
PROGRAM_NAME " with a `passenger_log_file`");
result = NGX_ERROR;
goto cleanup;
} else if (cycle->new_log.file->name.len > 0) {
psg_json_value_set_ngx_str_ne(j_log_target, "path", &cycle->new_log.file->name);
} else if (cycle->log->file->name.len > 0) {
psg_json_value_set_ngx_str_ne(j_log_target, "path", &cycle->log->file->name);
}

One potentially relevant change between Nginx 1.18 (the version in buster) and Nginx 1.22 (the version in bookworm) is the addition of the -e command line flag to control what Nginx's default error log is set to. I'm not sure this should matter when error_log is being set in the the http block, but it was the one thing I noticed related to error logging that changed between the two versions.

@ajhodgson
Copy link

ajhodgson commented Aug 6, 2024

I'm also seeing this alert while trying to update the passenger docker container to base it on Ubuntu Noble, which uses Nginx 1.24. Was just starting to try to track it down. This still uses the log forwarder.

2024/08/06 11:55:19 [alert] 37#37: no Phusion Passenger(R) log file configured, discarding log output

@CamJN
Copy link
Contributor

CamJN commented Aug 6, 2024

@md5 I was suggesting that hariapollo get nginx log forwarding to stdout to work and then worrying about Passenger if it doesn't write into the nginx logs. They previously indicated that their nginx logs weren't being written to stdout, so that's the first thing they should fix.

@md5
Copy link

md5 commented Aug 6, 2024

Thanks @CamJN. In our case, we are definitely seeing the Nginx access logging to stdout (via the access.log symlink), as well as that alert message. From my reading of the Passenger code, I think that alert message is going via Nginx's error_log (as it writes via data->cycle->log), which would mean it's going via the error.log symlink to /dev/stderr and then appearing in the container's combined log output from there.

@CamJN
Copy link
Contributor

CamJN commented Aug 8, 2024

The strange thing is, it doesn't reproduce for me, I can create a new noble or bookworm vm, and install passenger + nginx and when I start nginx the passenger logs are written to nginx's error log.

@md5
Copy link

md5 commented Aug 10, 2024

I was able to get rid of this error by configuring the error_log directive at in the root (top-level) scope instead of the http scope. I left our access_log configuration inside the http scope.

I didn't dig into why this behavior would have changed on either the Nginx or the Passenger side since we're only configuring a single error_log in our container and there is no reason not to have it at the top level. I suspect it's a side-effect of the implementation of nginx -e between version 1.18 and 1.22.

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

4 participants