You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With this code in my server blocks (included as a snippet):
if ($time_iso8601 ~ "^(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})") {}
access_log /var/log/nginx/$server_log_prefix.access.$year-$month-$day.log;
For some requests (probably something automated, probably invalid, maybe even malformed) nginx ends up with just this filename: ".access.--.log"
Depending on whether it is desired to rotate such logs (or even drop these requests or whatever), following code in http block will always give the date, and without using an "if":
Just a tip which I found no better place to tell.
Tested on nginx/1.10.3.
Docs say, the lowest required version is the same 0.9.6, and that with at least 1.11.0 it could combine all parts into one $date variable in one map expression, like this:
With this code in my server blocks (included as a snippet):
For some requests (probably something automated, probably invalid, maybe even malformed) nginx ends up with just this filename: ".access.--.log"
Depending on whether it is desired to rotate such logs (or even drop these requests or whatever), following code in http block will always give the date, and without using an "if":
Just a tip which I found no better place to tell.
Tested on nginx/1.10.3.
Docs say, the lowest required version is the same 0.9.6, and that with at least 1.11.0 it could combine all parts into one $date variable in one map expression, like this:
But I didn't test this.
P.S. On second thought, this particular case does not need complex capturing and this works just fine in 0.9.6 and later:
The text was updated successfully, but these errors were encountered: