Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

One website i was asked to look at has lots of traffic. They disabled the access_log for performance reasons (it doesnt look bad tho) and i was wondering how many hits they were getting per minute/hour/whatever.

Without enabling the access_log how can i check hits per minute/hour/day on an apache server? Maybe a line of code on the homepage for a guesstimate?

share|improve this question
Did disabling the access_log actually make that much of a difference? How much of a difference did it make? You did have some actual data to support that change right? – Zoredache Nov 16 '11 at 22:24
What @Zoredache said -- If you don't have a valid reason to turn off access_log then leave it on. – voretaq7 Nov 16 '11 at 22:35
@Zoredache It was done before i looked at it. I rather not enable it since i was told to only look and not touch anything. – acidzombie24 Nov 16 '11 at 22:41
Well if you're not allowed to touch anything that really does make managing the system difficult, doesn't it? :-) – voretaq7 Nov 16 '11 at 22:45
up vote 6 down vote accepted

you could try enabling mod_status which will give you that information and much more e.g.

Current Time: Wednesday, 16-Nov-2011 21:52:01 GMT
Restart Time: Wednesday, 16-Nov-2011 21:51:50 GMT
Parent Server Generation: 0
Server uptime: 10 seconds
Total accesses: 0 - Total Traffic: 0 kB
CPU Usage: u0 s0 cu0 cs0
0 requests/sec - 0 B/second -
1 requests currently being processed, 5 idle workers


Scoreboard Key:
"_" Waiting for Connection, "S" Starting up, "R" Reading Request,
"W" Sending Reply, "K" Keepalive (read), "D" DNS Lookup,
"C" Closing connection, "L" Logging, "G" Gracefully finishing,
"I" Idle cleanup of worker, "." Open slot with no current process

Srv PID Acc M   CPU     SS  Req Conn    Child   Slot    Client  VHost   Request
0-0 4957    0/0/0   W   0.00    5   1369611147  0.0 0.00    0.00    host.lan    GET /server-status HTTP/1.1
share|improve this answer

Is mod_status enabled? is an example output, and it has requests/s since startup and grand totals.

share|improve this answer

Google Analytics does a pretty good job.

share|improve this answer
Why with the downvotes? This is actually a good solution! (It's free, requires no server changes, and even gives the boss pretty reports on drool-proof paper!) – voretaq7 Nov 16 '11 at 22:36
i thought it was a ok answer. I think they have GA setup but i dont have the account info to log into that. -edit- does anyone know if you can do hits per hour or minute and not day? – acidzombie24 Nov 16 '11 at 22:43
Agreed - I up'd it. Another option is ChartBeat for realtime analytics of a live site as it's running. – databyte Nov 16 '11 at 23:32

In progress by HaZe as of 11-16-11
It gets the IP from the user, even behind a PHP proxy (VPNs are still hidden).
if (getenv("HTTP_X_FORWARDED_FOR")) { 
      $ipaddress   = getenv("HTTP_X_FORWARDED_FOR"); 
    } else { 
      $ipaddress   = getenv("REMOTE_ADDR"); 
$localdate = date("l j F Y g:ia", time() - date("Z")); 
$useragent = $_SERVER['HTTP_USER_AGENT']; 
$referer = $_SERVER['HTTP_REFERER'];
$page = $_SERVER['REQUEST_URI'];
$useragent = strip_tags($useragent); 

$varlog = fopen("access-log-php.html", "a"); 

// Write data
fwrite($varlog, $ipaddress); 
fwrite($varlog, "<br>"); 
fwrite($varlog, $localdate); 
fwrite($varlog, "<br>"); 
fwrite($varlog, $page); 
fwrite($varlog, "<br>"); 
fwrite($varlog, $useragent);
fwrite($varlog, "<br>"); 
fwrite($varlog, $referer); 
fwrite($varlog, "<br><br>"); 

// Close file


You can try this, just add it to the index page if it's PHP, or better yet, pop it in the "Header.html" file as a PHP function.

Every time it loads it will give you the user's IP, referrer, user agent, and page viewed.

Crudely, save this where it needs to go, for one hour, then cut and paste the file it generates (access-log-php.html) to a place where it won't be edited. You can look inside and count how many hits.

Alternatively, set up a PHP SQL function where it increments by one, and stores to a table on a database, for one hour.

PHP is the way to go, though.

share|improve this answer
If he disabled the access log for performance reasons, then trying to re implement access logging in a web-app seems silly. Why wouldn't you simply re-enable the access log. – Zoredache Nov 16 '11 at 22:22
"They disabled the access_log for performance reasons" Maybe he isn't able to turn it on? The PHP to access-log-php.html file it generates is the easiest way to implement it, you don't need to change ANY settings unless PHP is disabled. – U4iK_HaZe Nov 16 '11 at 22:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.