是否可以在 apache 中记录响应的第一行?

发布于 2024-09-02 03:35:25 字数 621 浏览 6 评论 0原文

我们有一个 Tomcat 服务器,我们正在尝试记录发送响应的 HTTP 版本。我们已经见过几次,它似乎是 HTTP/0.9,它杀死了内容(我猜不支持?)。我们希望通过使用 apache 中的访问日志来获取一些统计信息。但是,由于此标题行没有任何前缀,因此我们无法使用 %{xxx}o 日志记录。

有办法得到这个吗?

示例:

响应是:

HTTP/1.1 503 This application is not currently available
Server: Apache-Coyote/1.1
Content-Type: text/html;charset=utf-8
Content-Length: 1090
Date: Wed, 12 May 2010 12:53:16 GMT
Connection: close 

And we'd like the catch HTTP/1.1 (或者,HTTP/1.1 503 This application is not current available

这可能吗?我们可以无法访问正在服务的应用程序,因此我们需要作为 Java 过滤器或在 tomcat 访问日志中执行此操作 - 最好在访问日志中。

We have an Tomcat server where we're trying to log the HTTP version which the response is sent with. We've seen a few times that it seems to be HTTP/0.9, which kills the content (not supported I guess?). We would like to get some stats on this by using the access log in apache. However, since the header line for this isn't prefixed by anything, we cannot use the %{xxx}o logging.

Is there a way to get this?

An example:

Response is:

HTTP/1.1 503 This application is not currently available
Server: Apache-Coyote/1.1
Content-Type: text/html;charset=utf-8
Content-Length: 1090
Date: Wed, 12 May 2010 12:53:16 GMT
Connection: close 

And we'd like the catch HTTP/1.1 (alternatively, HTTP/1.1 503 This application is not currently available.

Is this possible? We do not have access to the application being served, so we need to do this either as a Java filter, or in the tomcat access log - Preferably in the access log.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

岛歌少女 2024-09-09 03:35:25

启用 server.xml 中的 会写出每个请求的请求和响应标头。

例子:

19-May-2010 12:26:18 org.apache.catalina.valves.RequestDumperValve invoke
INFO:           protocol=HTTP/1.1

Enabling the <Valve className="org.apache.catalina.valves.RequestDumperValve"/> in server.xml writes out the request and response headers for each request.

Example:

19-May-2010 12:26:18 org.apache.catalina.valves.RequestDumperValve invoke
INFO:           protocol=HTTP/1.1
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文