Using ApacheTop with Cronolog
Jun 1, 2010
apache
This post is more than 18 months old. Since technology changes too rapidly, this content may be out of date (but
that's not always the case). Please remember to verify any technical or programming information with the current
release.
I love ApacheTop. I love Cronolog. After I installed cronolog and used it in my apache configuration, however, I found it more and more difficult to use apachetop. I stopped using it. Well, I finally came up with a bash script that eases my frustration with calling the proper path names for apachetop. Check it out:
My Custom Log Definition
The entry in httpd.conf
vhost contains this line:
CustomLog "|/usr/local/sbin/cronolog /etc/httpd/logs/%Y/%m/%Y-%m-%d-access_log" combined
Pretty simple - just keeping my logs separated.
My script
In order to make it easier on myself, I now invoke apachetop with this bash script.
webtop.sh
#!/bin/bash
apachetop -T 3600 -f "/etc/httpd/logs/`date +%Y`/`date +%m`/`date +%Y`-`date +%m`-`date +%d`-access_log"
And then I’m good to go.