四层Nginx代理配置日志

392 阅读1分钟

配置到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"';  
# 指定路径
access_log /nginx/log/access.log proxy ;  
error_log  /nginx/log/error.log warn ;