最佳的Apache日志POST数据的方式? [英] Best way to log POST data in Apache?

查看:1758
本文介绍了最佳的Apache日志POST数据的方式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设你有一个网站的API,在参数GET请求的形式接收数据,或者POST请求(比如,用标准URL-CN codeD,功放及; - 分隔POST数据)。如果要记录和分析API调用的GET请求会容易,因为他们将在Apache日志。有一个简单的方法来获得在Apache日志POST数据呢?

Imagine you have a site API that accepts data in the form of GET requests with parameters, or as POST requests (say, with standard url-encoded, &-separated POST data). If you want to log and analyze API calls, the GET requests will be easy, because they will be in the apache log. Is there a simple way to get the POST data in the apache log as well?

(当然,我们可以在应用程序日志明确POST数据,但我想有一个配置级别的方式,让code我不要担心。)

(Of course we could log the POST data explicitly in the application, but I'd like to have an configuration-level way that let me not worry about it in code.)

推荐答案

使用Apache的 mod_dumpio 。要小心,原因是显而易见的。

Use Apache's mod_dumpio. Be careful for obvious reasons.

注意mod_dumpio 停止记录在第一个空字符的二进制有效载荷。例如,一个的multipart / form-data的 A gzip压缩文件上传可能只会显示mod_dumpio前几个字节。

Note that mod_dumpio stops logging binary payloads at the first null character. For example a multipart/form-data upload of a gzip'd file will probably only show the first few bytes with mod_dumpio.

另外请注意,阿帕奇可能不会提及在的httpd.conf 这个模块,即使它在 present /模块文件夹中。只需手动添加的LoadModule 将正常工作。

Also note that Apache might not mention this module in httpd.conf even when it's present in the /modules folder. Just manually adding LoadModule will work fine.

这篇关于最佳的Apache日志POST数据的方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆