I am planning to do some performance related logging with Apache. The plan is to have special diagnostics information logged for every nth request on the live system. However, as this is live system, I am more interested in statistical sample than deterministic logs of logging every request.
Apache itself provides robust logging options for performance metrics (milliseconds per request, etc.) and one can add custom measurements using response headers.
Is there an easy way to do logging in Apache which would not concern all requests, but a statistical subset of them? This would 1) decrease the created log file size 2) have less performance impact on the diagnosed system.
And if there isn't such options yet, what would be the easiest way to get started with a custom module for custom logging?
Whether this solution is easy or not is relative to your skillset (or of your coworkers/colleagues) but Apache allows you to log to a pipe.
You could write a simple script in whatever language you choose that writes every Nth entry to a file and ignores the rest.