1

Is there any way of establishing what vhosts are keeping Apache processes busy, in real time?

Ideally I'd like a tool like top (or htop) that shows me which sites are busiest, or most costly, right now.

Could a tool like this be built on mod_log_forensic, which writes a strict log of when each request starts and ends? It wouldn't give you process IDs or CPU time, only the elapsed time from start to finish, but it might help track down leaky or long-running requests.

Marcus Downing
  • 788
  • 10
  • 18

2 Answers2

1

Feed your access logs to apachetop and see if that's any good for you. At least apachetop fills in your "See the most busiest site/URL in real time" wish.

Something like tail -f /var/log/apache2/*access_log | apachetop should work.

Of course, then there's logstalgia ... :-)

Janne Pikkarainen
  • 31,852
  • 4
  • 58
  • 81
  • Ooh, logstalia is pretty :) – Marcus Downing Jul 07 '14 at 12:59
  • `apachetop` looks useful, but suffers from the same weakness as any software that relies just on the log files, which is that the standard log format doesn't actually include the vhost name, just the path. I could change the log format, but then it wouldn't be the standard. On my system `mod_log_forensic` includes the `Host:` header, but that's probably because NginX is forwarding it to Apache. – Marcus Downing Jul 07 '14 at 13:11
1

Anything that is dependent on log files has the disadvantage that log entries are only generated once a request is complete.

Apache's mod_status shows the current requests, as they're being processed.

HBruijn
  • 77,029
  • 24
  • 135
  • 201