Welcome! Log In Create A New Profile

Advanced

$time_iso8601 is not set for invalid HTTP?

November 29, 2014 03:48PM
I use the if trick to get timestamped log names:

if ($time_iso8601 ~ "^(\d{4})-(\d{2})") {
set $year $1;
set $month $2;
}

access_log .../access-$year-$month.log combined;

However, with nginx/1.4.6 (Ubuntu) I see that for invalid HTTP requests $year and $month are not set. For example, with the above config after issuing from a shell:

~> printf foo | nc host 80

I see in the error log for nginx:

2014/11/29 21:28:57 [warn] 8#0: *18 using uninitialized "year" variable while logging request, client: 172.17.42.1, server: localhost, request: "foo"
2014/11/29 21:28:57 [warn] 8#0: *18 using uninitialized "month" variable while logging request, client: 172.17.42.1, server: localhost, request: "foo"

That leads for the log file named .access--.log

Is it because $time_iso8601 is only set for valid request? If so, is this just a bug or a feature?
Subject Author Posted

$time_iso8601 is not set for invalid HTTP?

igorb November 29, 2014 03:48PM

Re: $time_iso8601 is not set for invalid HTTP?

Maxim Dounin December 01, 2014 07:54AM

Re: $time_iso8601 is not set for invalid HTTP?

igorb December 01, 2014 08:23AM

Re: $time_iso8601 is not set for invalid HTTP?

Maxim Dounin December 01, 2014 10:56AM

Re: $time_iso8601 is not set for invalid HTTP?

Darren Pilgrim December 01, 2014 11:26AM

Re: $time_iso8601 is not set for invalid HTTP?

Oleksandr V. Typlyns'kyi December 01, 2014 12:42PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 132
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