【问题标题】:Log apache requests from localhost in different file在不同的文件中记录来自 localhost 的 apache 请求
【发布时间】:2015-11-26 15:39:57
【问题描述】:
我有一个带有 Apache/2.2.15 的 centos 6.7。我的网站在 /var/log/httpd/mywebsite.log 中的 Apache 日志请求。我还使用 api 并访问我使用 mywebsite.com/api 的 api。在 api 中,请求是由 localhost 发出的。问题是我们需要单独保存日志。我想必须记录文件。一个用于 mywebsite.com/api,一个用于 mywebsite.com
【问题讨论】:
标签:
apache
logging
centos
【解决方案1】:
SetEnvIf Remote_Addr ^127\.0\.0\.1 islocal
CustomLog logs/access_log common env=!islocal
CustomLog logs/access_log_local common env=islocal