Welcome! Log In Create A New Profile

Advanced

Re: Using dynamic access_log, automatically create parent directory

Francis Daly
July 28, 2015 06:46PM
On Sun, Jul 26, 2015 at 10:49:01PM -0400, justink101 wrote:

Hi there,

> We use a dynamic value for access logs:
>
> access_log /var/log/nginx/domains/$host/access.log main;
>
> However, if the $host directory does not exist in /var/log/nginx/domains
> nginx fails with an error creating the access log. Is there a way to have
> nginx create the $host directory automatically instead of failing?

Not in stock nginx.

You could create a patch to do it; but I suspect that the overhead of
an extra "mkdir -p"-like call for every log line written would not be
worth it.

If you are willing to rearrange your log file structure such that the
variable part is in the filename, and not a parent directory name,
then stock nginx can help you.

> Seems like this should be default behavior?

I think "no".

But it's the person who writes the code who has the opinion that matters;
at least for their local version of nginx.

f
--
Francis Daly francis@daoine.org

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Using dynamic access_log, automatically create parent directory

justink101 July 26, 2015 10:49PM

Re: Using dynamic access_log, automatically create parent directory

Francis Daly July 28, 2015 06:46PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 300
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready