2017-06-30 3 views
1

Wie schließe ich img-Dateien von meinem Apache-Zugriffsprotokoll aus? Ich kann es nicht zur Arbeit bringen. Ich habe versucht, dieseApache 2.4 exclude img vom Zugriffsprotokoll

## flag robots.txt requests 
    SetEnvIf Request_URI "^/robots\.txt$" robots-request=log 
    ## flag favicon requests 
    SetEnvIf Request_URI "^/favicon\.ico$" favicon-request=nolog 

    ## flag image requests 
    SetEnvIf Request_URI "(\.gif|\.png|\.jpg)$" image-request=nolog 

    ## flag Css and JS requests 
    SetEnvIf Request_URI \.css css-request=nolog 
    SetEnvIf Request_URI \.js js-request=nolog 

    ## flag cron calls 
    SetEnvIf Request_URI "(^/cron\.php|^/bgp-start/)" cron-request=nolog 

    ## set do_not_log if any of the above flags are set 
    SetEnvIf robots-request nolog do_not_log 
    SetEnvIf favicon-request nolog do_not_log 
    SetEnvIf image-request nolog do_not_log 
    SetEnvIf css-request nolog do_not_log 
    SetEnvIf js-request nolog do_not_log 
    SetEnvIf cron-request nolog do_not_log 

ich diese

+0

grep -r für Ihre CustomLog Richtlinien und stellen Sie sicher, dass sie! do_not_log am Ende haben. – covener

Antwort

1

Richtlinien meiner apache2.conf hinzugefügt hinzuzufügen hinzufügen SetEnvIf und CustomLog VHOST Konfiguration, wie zum Beispiel:

<VirtualHost *:80> 
    ErrorLog ${APACHE_LOG_DIR}/error.log 
    LogLevel warn 

    SetEnvIf Request_URI "\.png$|\.gif$|\.jpg$|\.js$|\.css$" is_exclude 
    CustomLog ${APACHE_LOG_DIR}/access.log combined env=!is_exclude 
</VirtualHost> 
+0

Danke, es funktioniert! –