I am trying to enable access log for stream on 1.15.9-1~xenial but log_format definition doesn't seem to work. Config syntax check fails as if stream log_format was not defined
>
$ cat nginx.conf
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
...
include /etc/nginx/stream.conf;
>
/etc/nginx$ cat stream.conf
stream{
access_log /var/log/nginx/stream.access.log proxy;
log_format proxy '$remote_addr [$time_local] '
'$protocol $status $bytes_sent $bytes_received '
'$session_time "$upstream_addr" '
'"$upstream_bytes_sent" "$upstream_bytes_received" "$upstream_connect_time"';
...
}
>
$ sudo nginx -t
nginx: [emerg] unknown log format "proxy" in /etc/nginx/stream.conf:3
nginx: configuration file /etc/nginx/nginx.conf test failed
Escape issue? Does nginx -t actually test the content of log_format string? I used the string from https://nginx.org/en/docs/stream/ngx_stream_log_module.html#log_format