![]() | |||||||
Real Time Visitor Stats! Hey guys. Y'all ever think "man I wish I had real time stats to know when someone is on my site, where they are clicking, what site reffered them". Guess what, you CAN! Woohoo! :) Apache, the most comon webserver keeps logs of such actions. Logging into your box via the shell, we can see these live stats. Ready? Lets go! Step 1: Ok, first log into your shell. (SSH always - telnet is not secure at all) Putty is a free SSH client if anyone needs, just type in your domain and boom. Now we are inside the linux box. Its as if we are sitting right there and we can control it remotely. Step 2: Lets go to the directory with all our logs in it for all domains hosted on the box. All domains hosted on the box should have a log here. Different servers and configurations might be slightly different but most if not all are located here. Also, if you are not root user its ok. You may only be able to see YOUR domain stats though. Example, if I am bob.com I might not be able to see Mike.com unless super user. Step 3: Alright. Now we can use any linux command to view these logs. In this example, we want to be constantly looking at the very last part of the log file, to get real time stats, so we will type tail -f domain.com In this case we want the logs for OurVote.us so we type [b]tail -f ourvote.us[b] Ready for our results??? Amazing! You can see what IP your current visitor is from, what browser he is using, what OS he has, what refferal URL he came from, what current URL he is on now, etc! This screen will update real time. So if you have a high traffic site, watch our your screen might get flooded. But yep.. This is how lots of site trackers work too. Your webbrowser and webserver interact nicely with each other and give you this data. Hope yall found this usefull.. This was my first turorial - Made it originally for Invest1010 but thought the world should be more aware of this techniqe. Take care guys! :o |
Just to add in a few other commands that will help a little more tail -f <logfile> & This will allow you to still use the console (ie do other stuff) and the log tailing will still work also another good one which will get rid of alot of the noise in the log file (like images etc) is tail -f <log file> | egrep -v "jpg|png|ico|css|gif|js|feed|rss|Slurp|GoogleBot|ms nbot" This will also not sure bots indexing your site, they usally hit in batches, and might load upto 100 pages in a few minutes, so it's a good idea to filter them out as well. |
Thanks for sharing Mike I didn't know about this and am glad to know myself. I am going to try it on my sites now as well to see how it works out for me. Thanks, Kevin |
Hey, this is most helpful. Rep ++ for both Mike and Justin. I did not know this little trick. :) |
Thanks for the helpful tips! Too bad I don't run any servers myself :( |
| All times are GMT -7. The time now is 09:13 AM. |
Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0