Welcome! Log In Create A New Profile

Advanced

ngx_stream_log_module log_format not working

yuy
March 17, 2019 01:21AM
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
Subject Author Posted

ngx_stream_log_module log_format not working

yuy March 17, 2019 01:21AM

Re: ngx_stream_log_module log_format not working

Francis Daly March 17, 2019 04:48AM

Re: ngx_stream_log_module log_format not working

CCS March 18, 2019 07:25AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 65
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready