On Tue, Mar 09, 2010 at 06:20:36PM +0000, Gaby Vanhegan wrote:
> On 9 Mar 2010, at 17:42, Ozgur Kazancci wrote:
>
> > Apache doesn't come with such a feature. I tried mod_cband. It was quite
> > unstable, has too many bugs, issues. (Dozens of unfixed security
> > issues, bugs since few years:
> http://sourceforge.net/tracker/?group_id=154335&atid=791368
> > ), there is no more development for that module and it is abandoned
> > by its developer. I tried some other modules such as mod_bandwidth,
> > mod_curb, mod_bw, but no luck. Pretty old and 'expired' modules.
>
> Thinking about this a little more, you could perhaps create a LogFormat string
> that dumped the hostname, bytes in and out to a logfile somewhere. This could
> then be parsed every 5 minutes or so by a cron job, stats tabulated and Apache
> configs adjusted accordingly.
>
> You could then perhaps have a RewriteRule and use a RewriteMap to match
> specific hostnames that need redirecting to the "bandwidth reached" page.
> When a host hits it's bandwidth limit then an entry is created in the map and
> that site gets redirected to the holding page.
>
> Just a vague idea, probably full of holes but it could be a step in the right
> direction.
In fact, this information is contained in /var/www/logs/access_log in
the default configuration (the last field is the number of bytes in the
response, not including headers).
This should be doable with a cron script.
Joachim