Excluding local ip from Bandwidth usage

fre0n

Verified User
Joined
Jul 3, 2006
Messages
9
I got a nasty problem. One of my cients is running ht://dig as a search engine. This engine crawls his site nightly, generating over 1GB of local traffic. This is traffic not leaving the machine so it doesn't need to be counted as bandwith usage.

Is there a way to exclude this ip address, to have it recognized as local in directadmin?
 
Hello,

DA logs apache bandwidth using a CustomLog with a basic "LogFormat "%b" bytes" format.. so no IP is logged there.

The only way that I can currently think of to remove that bandwidth would be to go through the apache access logs.. find all the requests from the IP in quest.. figure out how much bandwidth it had used, and then substract that from the tally in the /usr/local/directadmin/data/users/username/bandwidth.tally file. This would require scripting, so programming knowhow is needed.

John
 
I found this on the web

Conditional Logging
There are times when it is convenient to exclude certain entries from the access logs based on characteristics of the client request. This is easily accomplished with the help of environment variables. First, an environment variable must be set to indicate that the request meets certain conditions. This is usually accomplished with SetEnvIf. Then the env= clause of the CustomLog directive is used to include or exclude requests where the environment variable is set. Some examples:

# Mark requests from the loop-back interface
SetEnvIf Remote_Addr "127\.0\.0\.1" dontlog
# Mark requests for the robots.txt file
SetEnvIf Request_URI "^/robots\.txt$" dontlog
# Log what remains
CustomLog logs/access_log common env=!dontlog

I think I might try this in the users httpd.conf file first, as i noticed the logs are some kind of customlogs :) I hope it will work, as it is much easier than postprocessing this thing.
 
Back
Top