Results 1 to 9 of 9
  1. #1

    How to check monthly-traffic for a directory?

    Guys, is there a way to make a script that will check monthly-traffic for a directory? I'm using PHP btw...

    Best Regards, WilliamK

  2. #2
    Th only thing I can think of is to have an counter inside an include, which is then put in each file of the directory.

    I'm guessing you can't do that but nothing else comes to mind. Interesting question!

  3. #3
    Thanks, but that wouldn't help on my case. :-(

    There must be a way, I will research more next week when I got my ADSL installed. ;-)


  4. #4
    Join Date
    Sep 2002
    Use apache for that
    How's my programming? Call 1-800-DEV-NULL

  5. #5
    Ok, what you mean by use Apache for that, I got apache already, but what now? :-\


  6. #6
    Join Date
    Nov 2002
    create a sub domain pointing to that directory then you can check the stats for the sub domain...

    and you can access the dir with or

    something like this might work for you...

    - t3r0

  7. #7
    Thanks t3r0, but in my case it won't work, since I use Wild-Card DNS SubDomains. :-(

    Looks like I will have to search how to build up my own stat scripts...


  8. #8
    Join Date
    Apr 2003
    Los Angeles, CA
    There are two ways to do it that I can think off:

    1) Process the access_log nightly and select only lines that are relevant for the subdirectory -- eg. grep and then run it through a log analyzer.

    2) If you need it real-time, then you can pipe the access log (to a script or program that will do the counting real-time. See:

    I have this setup running on a shared SSL server to split up logs for each domain (subdir => domain) -- real time. The C program used a full 1 second of CPU time in 15 days. So performance is not an issue.

    -- EDIT --

    Looks like you don't need to do anything special. From the apache doc (URL above):

    The third argument is optional and controls whether or not to log a particular request based on the presence or absence of a particular variable in the server environment. If the specified environment variable is set for the request (or is not set, in the case of a 'env=!name' clause), then the request will be logged.

    Environment variables can be set on a per-request basis using the mod_setenvif and/or mod_rewrite modules. For example, if you want to record requests for all GIF images on your server in a separate logfile but not in your main log, you can use:

    SetEnvIf Request_URI \.gif$ gif-image
    CustomLog gif-requests.log common env=gif-image
    CustomLog nongif-requests.log common env=!gif-image"
    You could do something like that but for the sub-directory instead of GIF images; then you have a log for this sub-dir only and can process if through a log analyzer and get all kinds of info -- bandwith, hits, referers...
    Last edited by luki; 05-01-2004 at 09:48 PM.
    Pings <1 ms, Unlimited Transfer, Lowest Price: http://localhost/

  9. #9
    Luki, thanks a lot for the help, I will sure use those tips. ;-)

    Best Regards, WilliamK

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts