Default log file locations

Peter Bittner peter.bittner at gmx.net
Thu Jun 27 17:44:22 UTC 2019


I may be a bit ignorant about system-level operations, I apologize.

Can you explain why this works better with writing to a file (i.e. the
hardcoded location /var/log/nginx/*.log)?

Peter

On Thu 27 June 2019 19:35 Valentin V. Bartenev wrote:
>
> On Thursday 27 June 2019 19:12:51 Peter Bittner wrote:
> > Hi there!
> >
> > In my day job I'm helping to get applications from traditional
> > environments running in cloud environments. Cloud native applications
> > are just "normal" applications, but there are a few properties that
> > they should satisfy (apart from resiliency and scalability).
> >
> > For logging this boils down to what is prescribed by the 12-factor
> > app: The log output should be a continuous stream, i.e. simply log to
> > the terminal.
> >
> > Now, as of today, at least on Debian based container images, the
> > behavior of Nginx is to write to /var/log/nginx/access.log and
> > /var/log/nginx/error.log by default. We try to compensate this by
> > making those files symbolic links to /dev/stdout and /dev/stderr.
> > We're doing this also, because there seem to be cases when a log entry
> > is written _before_ it is configured via the Nginx configuration file.
> >
> > From my perspective it would be advantageous to have Nginx write to
> > the terminal by default (i.e. no hardcoded log file locations) and
> > allow to override this behavior via the Nginx configuration file.
> >
> > Is there any reason why the default behavior is not that way yet?
> [..]
>
> Afaik, there's no way in Linux systems to write to terminal in
> non-blocking manner.  As the result, writing log can block the
> whole nginx worker process and cause DoS.
>
> IMHO, it's not a good idea to make your web-application depend
> on logging capabilities.
>
>   wbr, Valentin V. Bartenev


More information about the nginx-devel mailing list