Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We plan to use a tracking pixel to collect some analytics. It would be very helpful to configure a different policy for storing access logs to this pixel (

Can Apache be configured to filter and store only the access logs that contain a specific URL pattern on a different location than the main access log? We still want to keep the full access log on the initial partition, with a different retention policy.

share|improve this question
up vote 4 down vote accepted

You could use mod_setenvif to set an environment variable related to your tracking pixel and then filter the logs using it. something like

SetEnvIf Request_URI "tracking\.png$" tracking

CustomLog logs/access_log common env=!tracking
CustomLog logs/tracking_access_log common env=tracking

If the tracking pixel is requested then the environment variable gets set and the event gets logged to a different file.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.