nginx四层代理日志配置
stream {
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"';
server {
allow 192.168.1.0/24;
allow 192.168.2.0/24;
allow ip/16;
allow 1ip/32;
deny all;
access_log /var/log/nginx/tcp-redis.log proxy ;
open_log_file_cache off;
listen 6379;
proxy_connect_timeout 28800;
proxy_timeout 86400;
proxy_pass ip:6379;
}
server {
# allow 192.168.1.0/24;
# allow 192.168.2.0/24;
# allow 183.14.0.0/16;
# allow ip/32;
# deny all;
access_log /var/log/nginx/tcp-jumpserver.log proxy ;
open_log_file_cache off;
listen 22223;
proxy_connect_timeout 28800;
proxy_timeout 86400;
proxy_pass ip:22223;
}
}