Forum Moderators: phranque
I'm looking for a console based (text - not X) realtime apache monitor that can watch the log or the actual processes and display the IP address (resolved would be nice) on the screen and the current page they're looking at. Similar to `top`.
Right now I just `tail -f` the log and grep filter the stuff I don't want to see ie., :
tail -f access_log ¦ grep -v some.ip.address.here ¦ grep -v some/specific/directory/here
When the activity level is high things move so quickly I can't monitor very easily.
If anyone knows of something like this, I'd really like to hear about it (links to it would be great!).
Thanks in advance,
Al Bunch
<snip>
[edited by: trillianjedi at 8:23 pm (utc) on Dec. 6, 2006]
[edit reason] No sigs please as per TOS [/edit]
tail -f access_log ¦ cut -d' ' -f1,7 ¦ grep -v .jpg ¦ grep -v .php ¦ grep -v .css ¦ grep -v .gif
Of course you could substitute anything in the grep -v commands that you wanted to filter out, or you could just look for the lines you want to see.
It works, for now, but I'm still out there searching.
Would like to see a console based monitor screen - similar to this?
+--------------------------------------------------------+
¦Web server: reovest.com Monitoring 3 active users ¦
+--------------------------------------------------------+
¦httpd1: 123.122.27.122 /index.html ¦
¦httpd2: [idle] ¦
¦httpd3: 64.12.25.222 /cgi-bin/post.cgi?name=a¦
¦httpd4: 202.6.77.118 /property/links.html ¦
¦httpd5: [idle] ¦
¦httpd6: [idle] ¦
¦httpd7: [idle] ¦
+--------------------------------------------------------+
You get the idea...something that stays on the screen would be nice rather than watching it roll off.
Thanks for the input with the tail -f and the awk commands...I'm not too familiar with awk so I did it with cut.
I do have something that will scrub your apache log file and resolveip all the ip addresses it finds (sorted and uniq'd of course) if you're interested, I'll sticky you a copy or just post it here.
-Al
That would indeed be nice.
<idle pondering>
You can configure Apache to log the pid of the child server that processes each request along with all the usual info that's logged. Now if that was combined with a ps command and all tied together with Perl... hmm...
</idle pondering>
Anyway, just for reference here's my tidied up, working tail and awk combination.
tail -f access.log ¦ awk {'if ($7 ~ /html¦php¦cgi/) print $1 " " $7'}