This is a discussion on "Using standard web logs" within the PHP Forum section. This forum, and the thread "Using standard web logs are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Using standard web logs
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
Using standard web logs
Hi,
Im looking to build a php file upon my server that checks my server web logs (iis server) and displays them graphically on another page, refreshing every hour. Has anyone played with this before or come across scripts that allow you to do this?? Any help would be greatly appreciatted, as my experience with web logs is limited! Thanks in advance. eon201 |
|
|
|
#2
|
|||
|
|||
|
Re: Using standard web logs
I have found a free perl script call weblog ( http://awsd.com/scripts/weblog/ ), its a perl script and seems to do the things I want it to. But how compatible are perl and php. Im thinking they work well together as php seems very very similar... Does anyone have any experience with this???
Thanks. eon201 |
|
#3
|
||||
|
||||
|
Re: Using standard web logs
Perl is generally the best bet for these kinds of things..
Is there any particular reason you would like to use it? There are some great log packages out there... These can do much more than you could easily write with PHP Awstats (my favourite)..and available for IIS Webalizer
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
|
|
#4
|
|||
|
|||
|
Re: Using standard web logs
Hi again Rakuli,
What I am trying to do is to take the raw log files upon my server read them with php , calculate the values, and display information such as; Total page views per day No. of unique visitors Top 5 viewed pages Overall number of page views What percentage of users are using certain browsers What percentage of users are using certain os's And include visual and audible alerts from the javascript phone validating system you helped me create. Then print() the stats into a live page. I know that this seems ridiculous. And many people will say 'why dont you use google analytics', but i just cant. My boss just does not want it done that way. He wants it done so that we can display it on a plasma in the office and it just refreshes itself. That way we know when an alert hits for the phone callback validation. This is the only way he wants it done So far I can get my php to read the .txt log files . But what I really want it to do is skip the first 4 lines of code, then I need to seperate each piece of data into a variable... Is this possible? I cant seem to find any literature on how to do this.. Thanks. eon201 |
|
#5
|
||||
|
||||
|
Re: Using standard web logs
Can you show me an example of the raw log for your server? Then I can show you some code of how to break it up.
Cheers,
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
|
|
#6
|
|||
|
|||
|
Re: Using standard web logs
quick question.... Is it safe to post that kind of information on a forum?? Can it be used in a malicious way by someone????
thanks eon201. |
|
#7
|
||||
|
||||
|
Re: Using standard web logs
Just paste a few lines and replace the text -- it's just so I can see the format..
Change anything that may identify your server
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
|
|
#8
|
|||
|
|||
|
Re: Using standard web logs
OK so im using this code so far in my php...
Thanks, eon201 ps. You would have thought I could have had something easier to do in my first php challenge! lol |
|
#9
|
||||
|
||||
|
Re: Using standard web logs
Okay, so this should be simple enough...
here is a quick script I made for you -- it is commented so you can see what is happening.
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
|
|
#10
|
|||
|
|||
|
Re: Using standard web logs
lol. im a noob. Thanks for that, really appreciatte it...
But why am I getting errors such as:
Is this becuase I have not echo'd the variables yet?? |
|
#11
|
||||
|
||||
|
Re: Using standard web logs
My bad sorry,
Replace explode(' ', $content); with explode(' ', $contents);
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
|
|
#12
|
|||
|
|||
|
Re: Using standard web logs
hmmm.. ok now its giving me the errors of 'Notice: Undefined offset' on the same line that we just edited.
And it is echo'ing data from the first four lines. |
|
#13
|
||||
|
||||
|
Re: Using standard web logs
Hmm, the log file says there are 19 different fields but the actual sample log has only 18.....
try replacing
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
|
|
#14
|
|||
|
|||
|
Re: Using standard web logs
your going to end up hating me rakuli! lol.
Still erroring...
|
|
#15
|
||||
|
||||
|
Re: Using standard web logs
Gosh! I did it again
$logBits = explode(' ', $content); should be $logBits = explode(' ', $contents);
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
|
|
#16
|
|||
|
|||
|
Re: Using standard web logs
ok getting there slowly, but it's still erroring (Notice: Undefined offset) on this line....
|