在不同的文件中记录来自本地主机的 apache 请求

Log apache requests from localhost in different file

我有一个带有 Apache/2.2.15 的 centos 6.7。 Apache 在 /var/log/httpd/mywebsite.log 中记录来自我网站的请求。我还使用 api 并访问 api 我使用 mywebsite.com/api。在 api 中,请求是由 localhost 发出的。问题是我们需要单独保存日志。我想要记录文件。一份用于我的网站。com/api 一份用于 mywebsite.com

SetEnvIf Remote_Addr ^127\.0\.0\.1 islocal
CustomLog logs/access_log common env=!islocal
CustomLog logs/access_log_local common env=islocal