ngx_stream_log_module log_format not working

yuy nginx-forum at forum.nginx.org
Sun Mar 17 05:21:32 UTC 2019


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

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,283403,283403#msg-283403



More information about the nginx mailing list