I have almost 200 subdomains on NGINX and have the directive
access_log /var/log/nginx/$host-access.log;
The problem is none of the subdomain access log files actually exist, so the error log is loaded up with errors like
(13: Permission denied) while logging request...
This is a Wordpress Multisite installation, so subdomains are created inside the WP database. NGINX knows nothing until a request comes in.
How should this be handled? I've thought about writing a PHP script that parses the URI and checks for the presence of the log file, writing it if it does not exist. I don't care if the very first request is not logged. Or is there a way to have NGINX create the log file initially, if it does not exist? I know that would create some trash log files from bad requests. The PHP script would avoid that. Any advice is appreciated!