Apache2 mod_dumpio 记录的输出字节与 access.log 中的 %O 不匹配

Apache2 mod_dumpio 记录的输出字节与 access.log 中的 %O 不匹配

我试图了解为什么尽管内容(+ 标题)很小,但服务器发送的响应却很长。

为此,我使用 mod_dumpio 来记录 apache 接收和发送的所有数据。但日志并未显示所有发送的字节。

示例请求:在 access.log 中,%O 标志给出 5636 个字节

-- 78.242.XX.YY - - [04/Nov/2020:13:29:51 +0100] "GET /rest/instant_message/TEST HTTP/1.1" 200 **5636** "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36"

在 error.log 中,dumpio 日志告诉我 header 是 947 字节,内容是 13 字节。

[Wed Nov 04 13:29:51.668792 2020] [dumpio:trace7] [client 78.242.XX.YY:53902] mod_dumpio:  dumpio_out (data-HEAP): **947 bytes**
[Wed Nov 04 13:29:51.668801 2020] [dumpio:trace7] [client 78.242.XX.YY:53902] mod_dumpio:  dumpio_out (data-HEAP): HTTP/1.1 200 OK\r\nDate: Wed, 04 Nov 2020 12:29:51 GMT\r\nServer: Apache/2.4.25 (Debian)\r\nStrict-Transport-Security: max-age=15768000; preload\r\nReferrer-Policy: same-origin\r\nX-Xss-Protection: 1; mode=block\r\nX-Frame-Options: SAMEORIGIN\r\nX-Content-Type-Options: nosniff\r\nContent-Length: 13\r\nSet-Cookie: session=.eJxtkFtPwkAUhP_Lea4ktg1I3xCJQeITAbzEbI7b03rCdlv3wkXCf3dRI6HwuN_s7MzODkRDpkJN2kHmjKcIJOqBlGTtEBXpHM2ZMNo0qmaHjmt9Jk59eHHF9lSbM62HbKRn16a1UiQdviu6rLTxaBXK2hYc5wFywbJd6iDOLJm2YU4fLBUdca0LLiHbQVlhY8WStpDBYPyF0-3dIq36i75s1o_J4vllOLn2fvOQfD7dTu4nLzMzhgiCScjQgcJcr-lNp9eNu704uko6aTeNk_QtAuu2G9GErRVkBSobUr0lEfLlUhiyzrD8bf-j7iNgO8gr_v-OqsuScnEEwW5EwcY6jVXYCWSM8Ic5Pz0rvHSrMXXBh-UBD0kcSqAjb2D_DaAivrs.EoQwPw.xff5wtbwlLIlH16L3mZ7KbJdV9U; Expires=Thu, 05-Nov-2020 12:29:51 GMT; HttpOnly; Path=/\r\nCache-Control: max-age=0\r\nExpires: Wed, 04 Nov 2020 12:29:51 GMT\r\nKeep-Alive: timeout=5, max=100\r\nConnection: Keep-Alive\r\nContent-Type: application/json\r\n\r\n
[Wed Nov 04 13:29:51.668818 2020] [dumpio:trace7] [client 78.242.XX.YY:53902] mod_dumpio: dumpio_out
[Wed Nov 04 13:29:51.668826 2020] [dumpio:trace7] [client 78.242.XX.YY:53902] mod_dumpio:  dumpio_out (data-HEAP): **13 bytes**
[Wed Nov 04 13:29:51.668834 2020] [dumpio:trace7] [client 78.242.XX.YY:53902] mod_dumpio:  dumpio_out (data-HEAP): {"TEST": []}\n
[Wed Nov 04 13:29:51.668856 2020] [dumpio:trace7] [client 78.242.XX.YY:53902] mod_dumpio: dumpio_out
[Wed Nov 04 13:29:51.668864 2020] [dumpio:trace7] [client 78.242.XX.YY:53902] mod_dumpio:  dumpio_out (data-IMMORTAL): 0 bytes
[Wed Nov 04 13:29:51.669037 2020] [dumpio:trace7] [client 78.242.XX.YY:53902] mod_dumpio: dumpio_out
[Wed Nov 04 13:29:51.669050 2020] [dumpio:trace7] [client 78.242.XX.YY:53902] mod_dumpio:  dumpio_out (metadata-FLUSH): 0 bytes
[Wed Nov 04 13:29:51.669058 2020] [dumpio:trace7] [client 78.242.XX.YY:53902] mod_dumpio:  dumpio_out (metadata-EOS): 0 bytes
[Wed Nov 04 13:29:51.669106 2020] [dumpio:trace7] [client 78.242.XX.YY:53902] mod_dumpio: dumpio_out
[Wed Nov 04 13:29:51.669118 2020] [dumpio:trace7] [client 78.242.XX.YY:53902] mod_dumpio:  dumpio_out (metadata-EOR): 0 bytes
[Wed Nov 04 13:29:51.669638 2020] [dumpio:trace7] [client 78.242.XX.YY:53902] mod_dumpio: dumpio_out
[Wed Nov 04 13:29:51.669646 2020] [dumpio:trace7] [client 78.242.XX.YY:53902] mod_dumpio:  dumpio_out (metadata-FLUSH): 0 bytes
[Wed Nov 04 13:29:56.672936 2020] [dumpio:trace7] [client 78.242.XX.YY:53902] mod_dumpio: dumpio_out
[Wed Nov 04 13:29:56.672952 2020] [dumpio:trace7] [client 78.242.XX.YY:53902] mod_dumpio:  dumpio_out (metadata-FLUSH): 0 bytes
[Wed Nov 04 13:29:56.672967 2020] [dumpio:trace7] [client 78.242.XX.YY:53902] mod_dumpio:  dumpio_out (metadata-EOC): 0 bytes

5636-(947+13) 缺失的字节在哪里?

access.log格式:

LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\""

mod_dumpio 配置:

LogLevel dumpio:trace7
DumpIOInput On
DumpIOOutput On

相关内容