Cherokee access-log for specific file

92 Views Asked by At

Context: I'm monitoring an APT repository mirror server, who runs on Cherokee.
Goal: know how many computers have the mirror in their sources.list
Method: tracking GET requests for "dists/[..]/Release"
For Debian Wheezy, this would be dists/wheezy/Release.

Extracting the lines from the general access log won't be doable, the mirror is enough used to make the accesslog grow to 2 GB in just a few days. Just wanna know how many different IPs use the APT mirror, and Perl regular expressions are still a pain in the ass for me.

Is it possible to make Cherokee only logging access matching a request criteria (and how) ?

Fallback solution: what kind of redirect could pass the "Release" GET to a PHP script (who can sha1 hash the IP address and put as filename in a folder, quite easy counting), who then redirects back to the actual Release file ? (without redirect looping, and with the mirroring rsync in mind who has to reset this after each sync)

1

There are 1 best solutions below

0
On

Using cherokee-admin you can add a Behavior Rule that matches the "dists/[..]/Release" requests. You then go to "vServers/Behavior/Rule Management" and on the "Security" tab you check the "Skip Logging" option, disabling the logging for all rules except the one you've added.

what kind of redirect could pass the "Release" GET to a PHP script (who can sha1 hash the IP address and put as filename in a folder, quite easy counting), who then redirects back to the actual Release file ?

PHP can send the X-Sendfile (or X-Accel-Redirect) header, telling Cherokee to send the Release file.