gpt4 book ai didi

apache - 有没有办法在 apache 日志中获取内容长度(响应 header )?

转载 作者:行者123 更新时间:2023-12-04 17:10:24 26 4
gpt4 key购买 nike

我希望 Apache 显示响应 header 长度(此处为 90)。相反,它显示了一些也依赖于客户端的“奇怪”值。

尾部/var/log/apache2/access.log

xx.xx.xx.xx - - [16/Oct/2021:11:07:44 +0000] "POST /api/user HTTP/1.1" 200 796 "https://yy/login/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36 OPR/79.0.4143.72"

检查元素

HTTP/1.1 200 OKDate: Sat, 16 Oct 2021 11:07:44 GMTServer: Apache/2.4.41 (Ubuntu)Expires: Thu, 19 Nov 1981 08:52:00 GMTCache-Control: no-store, no-cache, must-revalidatePragma: no-cacheVary: Accept-EncodingContent-Encoding: gzipContent-Length: 90Keep-Alive: timeout=5, max=100Connection: Keep-AliveContent-Type: text/html; charset=UTF-8

最佳答案

找到解决方案:

/etc/apache2/apache2.conf 中,LogFormat 指令必须更改如下:%b 而不是 %O。

现在 access.log 按预期报告 90。

这也在这里讨论(评论者杰夫·帕基特):https://askubuntu.com/questions/264042/what-is-the-default-apache2-log-format-and-where-is-defined-such-default看起来这是 Ubuntu 特有的。

关于apache - 有没有办法在 apache 日志中获取内容长度(响应 header )?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69594264/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com