【问题标题】:Ignore / remove log patterns in Apache's access_log忽略/删除 Apache 的 access_log 中的日志模式
【发布时间】:2018-01-23 11:28:03
【问题描述】:

我有一个带有 mod_cluster 且配置最少的工作 Apache:

(mod_jk.conf)

LoadModule cluster_slotmem_module modules/mod_cluster_slotmem.so
LoadModule manager_module modules/mod_manager.so
LoadModule proxy_cluster_module modules/mod_proxy_cluster.so
LoadModule advertise_module modules/mod_advertise.so    

Listen 5555    
<VirtualHost *:5555>

  LogLevel warn
  <Directory />
      Require all granted
  </Directory>

  <Location />
    Order deny,allow
    Allow from all
  </Location>

  ManagerBalancerName mybalancer
  ServerAdvertise on
  EnableMCPMReceive On

  <Location /mod_cluster-manager>
    SetHandler mod_cluster-manager
    Order deny,allow
    Allow from all
  </Location>
</VirtualHost>

我的问题是,在我的 access_log 中我有:

...
ClusterListener/1.0
ClusterListener/1.0
ClusterListener/1.0
ClusterListener/1.0
ClusterListener/1.0
ClusterListener/1.0
ClusterListener/1.0
ClusterListener/1.0
ClusterListener/1.0
ClusterListener/1.0
ClusterListener/1.0
ClusterListener/1.0
...

我不想在我的 access_log 中记录这些“ClusterListener/1.0”。

我尝试在 httpd.conf 中更改我的 LogLevel:

...
LogLevel warn
...

我已经尝试将“LogLevel”放在我的 mod_jk.conf 中

但是,这些选项不起作用。我需要做什么才能删除这些日志?

【问题讨论】:

    标签: apache logging


    【解决方案1】:

    我找到了解决方案。我将 'LogLevel warn' 撤消到原始配置,因为这并不能解决问题。与大家分享。

    我所要做的就是将它添加到我的 httpd.conf 中:

    <IfModule log_config_module>
        #....
    
        SetEnvIf User-Agent "ClusterListener/1\.0" dontlog
    
        CustomLog "logs/access_log" env=!dontlog
    
         #...
    </IfModule>
    

    现在,我的 access_log 没有更多的“ClusterListener”日志。

    【讨论】:

      猜你喜欢
      • 2015-02-25
      • 2020-03-16
      • 1970-01-01
      • 1970-01-01
      • 2016-05-18
      • 2019-12-06
      • 1970-01-01
      • 2013-04-22
      • 1970-01-01
      相关资源
      最近更新 更多