如何使Nginx为TCP流打印完整日志

问题描述 投票:12回答:1

我使用具有以下配置的nginx-1.11.8。

stream {

    log_format  basic   '$time_iso8601 $remote_addr '
                        '$protocol $status $bytes_sent $bytes_received '
                        '$session_time $upstream_addr '
                        '"$upstream_bytes_sent" "$upstream_bytes_received" "$upstream_connect_time"';

    access_log      logs/stream.log  basic buffer=1k flush=5s;

    include *.stream.conf;
}

现在,我只能在tcp日志中获取IP和其他不重要的内容。我想知道tcp数据包中与IP有关的一些重要信息。我应该怎么做才能在TCP日志中获取完整的TCP数据包?预先感谢。

logging nginx tcp stream
1个回答
0
投票

如评论中所述,NGINX不是设计上的数据包嗅探器。

您可以查看可以在日志中显示的受支持变量:

http://nginx.org/en/docs/varindex.html

© www.soinside.com 2019 - 2024. All rights reserved.