0

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?

3
  • The overhead of most of these metrics is negligible - why not do your sampling from the log file instead of hacking Apache to do something it's not designed to do?
    – voretaq7
    May 7, 2014 at 17:01
  • The main reason is that the web server has quite high traffic, so the log files are growing fast and I am not interested all the information. Also, the standard access log does not have the information I want, so the special log file format takes much more disk space. May 7, 2014 at 17:11
  • Furthermore, I do not know if Apache is designed to do this or not, so I asked the question. If you know that Apache is not designed to do this I kindly suggest you point me to the related information in your answer. May 7, 2014 at 17:13

1 Answer 1

2

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.

2
  • 1
    If you're writing a CustomLog to a pipe you may as well just process the data directly (avoiding the disk space problem entirely)
    – voretaq7
    May 7, 2014 at 19:03
  • Thank for your comments @votetaq. However I have this odd feeling that I know what I am doing, so please do not press so hard. I want also include data from the outer edge of the system, which happens to be Apache, to have information about SSL/SPDY overhead. May 10, 2014 at 15:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .