Forum Moderators: phranque
You will need to have access to httpd.conf and it will work with Apache versions 1.3.13 and later. It should with Apache 1.3.7 and later.
Basically you prevent logging of specific directories using SetEnvIf and/or SetEnvIfNoCase
Enter the following in httpd.conf or srm.conf
I use srm.conf because it is less cluttered and easier to edit.
SetEnvIf Request_URI \.ida trash
SetEnvIf Request_URI /scripts trash
SetEnvIf Request_URI /c/winnt trash
SetEnvIf Request_URI /d/winnt trash
SetEnvIf Request_URI /_mem_bin trash
SetEnvIf Request_URI /_vti_bin trash
SetEnvIfNoCase Request_URI /msadc trash
It will also work with User-agents
SetEnvIf User-Agent NetMechanic trash
An environment variable trash is assigned to all requests for the above directories and files. To prevent logging you add env=!trash to your CustomLog path for each virtual host.
CustomLog /home/vhost/logs/access.log combined env=!trash
Apache will need to be restarted to effect the changes.
Also [url=www.webmasterworld.com/forum13/682.htm]BrowserMatch[/url] is an effective way of blocking bandwith sucking and pesty bots on a server wide basis.
SetEnvIf Request_URI \.ida trash
SetEnvIf Request_URI /scripts trash
SetEnvIf Request_URI /c/winnt trash
SetEnvIf Request_URI /d/winnt trash
SetEnvIf Request_URI /_mem_bin trash
SetEnvIf Request_URI /_vti_bin trash
SetEnvIfNoCase Request_URI /msadc trash
can be replaced with
SetEnvIf Request_URI (.*)cmd\.exe trash
SetEnvIf Request_URI (.*)root\.exe trash
SetEnvIf Request_URI \.ida(.*)$ trash
Searching for "access log cleaning script" or something along those lines might turn up something else useful. :)
From Apache documentation:
----
SetEnvIf directive
Syntax: SetEnvIf attribute regex env-variable[=value] [env-variable[=value]] ...
Default: none
Context: server config, virtual host, directory, .htaccess
Override: FileInfo
Status: Base
Module: mod_setenvif
Compatibility: Apache 1.3 and above; the Request_Protocol keyword and environment-variable matching are only available with 1.3.7 and later; use in
.htaccess files only supported with 1.3.13 and later
> Ok they were put after the modules and before the virtual servers.
> Shutting down httpd: [ OK ]
> Starting httpd: [FAILED]
> [FAILED]
> [FAILED]
The above error is strange. No reason was given as to why Apache failed. There should be an entry in your access_log and/or /var/log/messages file giving a reason why Apache failed. It could be a CustomLog file related error.
> Apache version problem?
You probably have Apache 1.3.7 or later because you did not get the Illegal option error again.
> Override: FileInfo
Check httpd.conf to see if AllowOverride is set to All or at least contains FileInfo
<Directory />
AllowOverride AuthConfig Limit FileInfo Options
Options All
</Directory>
Check you sticky mail