我们有一个内部应用程序,我想让 apache httpd 服务器基于每个客户端 ips 创建新的日志文件。在文档中,我看到您可以有多个日志。
http://httpd.apache.org/docs/2.2/logs.html
LogFormat "%h %l %u %t \"%r\" %>s %b" common
CustomLog logs/access_log common
CustomLog logs/referer_log "%{Referer}i -> %U"
CustomLog logs/agent_log "%{User-agent}i"
Run Code Online (Sandbox Code Playgroud)
但我真正想要的是这样的。
CustomLog logs/%h-access_log common
Run Code Online (Sandbox Code Playgroud)
其中 %h 被外推到 IP 地址,即 1.1.1.1-access_log
我想有一种 mod_perl 方法可以做到这一点,但只是想知道在我编写模块之前是否有人知道通过标准配置来做这样的事情的方法。