Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

get sessions from log file for stats? 1

Status
Not open for further replies.

ThomasJSmart

Programmer
Sep 16, 2002
634
hi,
Is there a way to get the amount of sessions from my apache log so i can use it to make a counter on my splash page?

I use Urchin for stats, but the Urchin pages are to much info to show my visitors. I would like to just show the total amount of sessions (visitors) on the splash of my site.

i know how to use php and my server supports cgi (i dont know any perl tho...)

thanks,
thomas

I learned a bit yesterday, today i learned a lot, imagine what i'll learn tomorrow!
 
Really quick & dirty:

#!/bin/sh
echo `cat /var/log/httpd/access_log |wc -l`

Substitute your file path. This will just show the number of log entries in the file. 2 problems with this that jump out at me: First, performance will degrade if you don't rotate your logs and second, your counter won't be accurate if you do.
 
it seems to work :) wicked thanks,

I learned a bit yesterday, today i learned a lot, imagine what i'll learn tomorrow!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top