【问题标题】:Apache RewriteLog only on specific IP?Apache RewriteLog 仅在特定 IP 上?
【发布时间】:2015-02-18 11:51:52
【问题描述】:

我已在我的 httpd conf 文件中启用日志记录,如下所示...

RewriteLog "/var/log/httpd/rewrite.log"
RewriteLogLevel 3

这很好用。我不想在调试时影响服务器,或者创建超出需要的额外信息。

有没有办法只记录特定 IP 地址的重写(如果没有,则通过其他标准缩小范围)?

【问题讨论】:

    标签: apache mod-rewrite apache2


    【解决方案1】:

    到目前为止我发现的一个解决方案是管道运算符,所以我添加了以下内容...

    RewriteLog "|/bin/grep '<myIpAddress>' > /var/log/httpd/debugrewrite.log"
    RewriteLogLevel 5
    

    不确定它的效率如何,因为它每次都会调用 grep,所以我不喜欢它,但目前它有助于减少日志记录,我一完成就将其关闭。

    【讨论】:

      猜你喜欢
      • 2011-01-02
      • 1970-01-01
      • 2014-10-23
      • 2015-10-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-01-04
      • 2015-11-27
      相关资源
      最近更新 更多