heroku / heroku-buildpack-nginx

Run NGINX in a Heroku app
244 stars 787 forks source link

Log directly to stdout/stderr #112

Open mars opened 1 year ago

mars commented 1 year ago

With everything else set per the solo config example, the following changes make Nginx log directly to stdout/stderr without intermediate filesystem writes & reads as well as no longer needing the multi-process handing in the start-up script:

error_log /dev/stdout info;

http {
  access_log /dev/stdout l2met;
}

This change would eliminate traffic-induced filesystem IO and eliminate filesystem consumption by logs.

Would these changes be welcome? To avoid breaking existing usages, we could offer them as a another option of start-up process, and example config/nginx.conf.erb.

stevenharman commented 1 year ago

Oh my, I was just looking for this! Please, make it happen, @mars!

(Also, 👋 Hi Mars! Hope you're doing well.)

stevenharman commented 1 year ago

Actually, it looks like error_log supports a special value, stderr to send directly to standard error. Though I think access_log still needs to point at /dev/stdout.