Forum Moderators: coopster

Message Too Old, No Replies

apache logs

read them?

         

c0nsur

4:24 pm on Aug 6, 2003 (gmt 0)

10+ Year Member



is there any log files in apache or something that tells which pages are seen

here is an example
205.236.245.134 - - [05/Aug/2003:14:32:47 -0400] "GET /cgi-bin/envoyer2.cgi?profil=Alexina HTTP/1.1" 404 299 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows 98)"

but i cant find anything with .php extension

if theres a file please tell me
an some example or idea of grabbing them would be appreciated! :)

thanks

vincevincevince

4:36 pm on Aug 6, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



that page isn't a .php page, that's .cgi

the log file to use is /logs/access.log
try a grep for .php in it?

c0nsur

4:58 pm on Aug 6, 2003 (gmt 0)

10+ Year Member



lol i know its a gci its was just an example of my log

thanks for the grep im gonna try right now! :)

c0nsur

5:02 pm on Aug 6, 2003 (gmt 0)

10+ Year Member



does it sounds good?

cat /var/log/apache/access.log grep .php filteredlog

if yes it shows .gif, .css etc....

dunno whatta do! :s

panic

5:10 pm on Aug 6, 2003 (gmt 0)

10+ Year Member



What sounds better is :

$file = file("/var/log/apache/access.log");

foreach($file as $line){

$line = trim($line);

if(preg_match("/php/",$line)){
print "$line\n";
}
else{
}
}

c0nsur

5:14 pm on Aug 6, 2003 (gmt 0)

10+ Year Member



of course its sounds really good this script but do i have to change any permission?

file("/var/log/apache/access.log") - Permission denied

if i change is it ok with apache or something?

c0nsur

5:22 pm on Aug 6, 2003 (gmt 0)

10+ Year Member



anyway i made a copy changed its mode now it works but theres no .php entry in that file!

so where it could be logged?

panic

5:22 pm on Aug 6, 2003 (gmt 0)

10+ Year Member



You can either do the following :

1) chmod 777 /var/log/apache/access.log
2) copy the access.log to a directory that's local to the PHP script.

-panic

c0nsur

5:49 pm on Aug 6, 2003 (gmt 0)

10+ Year Member



i really cant find anything

some0ne has an idea?

jatar_k

5:52 pm on Aug 6, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



hm if the pages on your site actually have a php extension and that is the right access log then I have a hard time with the fact that they aren't there.

Open the logfile with a text editor (I use textpad) and go through it to see what is in there.

panic

5:57 pm on Aug 6, 2003 (gmt 0)

10+ Year Member



Either that, or fire up vim if you're in Linux and have a look. If you still can't find anything, then maybe people just aren't viewing your PHP files.

-panic

c0nsur

6:12 pm on Aug 6, 2003 (gmt 0)

10+ Year Member



hey hey

i took a look in the httpd.conf file and i saw that log files are separated for each virtual host!

so here we go

216.132.86.107 - - [14/Jul/2003:22:18:14 -0400] "GET /abonnement.html HTTP/1.1" 200 30381 "-" "Mozilla/3.0 (compatible; Indy Library)"

does anyone knows what are those number? -->200 30381
200 is probably the code that the page returns like 404 etc...

an is this a god idea to analyse this file...cause i know there a lot of information maybe it will slow up the app!

i just need to get as much information as i can to build some stats

is there a better way?

ps. i already got colordepth,OS,browser type,screen resolution,ip etcbut i tough it will be a good idea to grab the last line for a specific IP to get the last page viewed! :)

so any idea is accepted :P

panic

6:27 pm on Aug 6, 2003 (gmt 0)

10+ Year Member



200 means OK. Here's a list of the more useful Apache codes:

100 Continue
101 Switching Protocols
200 OK
201 Created
202 Accepted
203 Non-Authoritative Information
204 No Content
205 Reset Content
206 Partial Content
300 Multiple Choices
301 Moved Permanently
302 Moved Temporarily
303 See Other
304 Not Modified
305 Use Proxy
400 Bad Request
401 Unauthorized Other Codes Continued:
402 Payment Required
403 Access Denied
404 Not found
405 Method Not Allowed
406 Not Acceptable
407 Proxy Authentication Required
408 Request Time-Out
409 Conflict
410 Gone
411 Length Required
412 Precondition Failed
413 Request Entity Too Large
414 Request-URI Too Large
415 Unsupported Media Type
500 Internal Server Error
501 Not Implemented
502 Bad Gateway
503 Service Unavailable
504 Gateway Time-Out
505 HTTP Version Not Supported

c0nsur

6:40 pm on Aug 6, 2003 (gmt 0)

10+ Year Member



is there any other way to get apache c0des?
i mean other than open the log file?

scotty28

6:50 pm on Aug 6, 2003 (gmt 0)

10+ Year Member



does anyone knows what are those number? -->200 30381

as stated by panic 200 represents the server code returned to the browser.

30381 represents the size of the file requested in bytes

panic

6:58 pm on Aug 6, 2003 (gmt 0)

10+ Year Member



N0 there is n0t.

The best way to go about it is to stick the data into a MySQL database (which is faster than you think).

-panic

c0nsur

7:00 pm on Aug 6, 2003 (gmt 0)

10+ Year Member



thanks scotty28 thats what i was looking for!

and now there another good question :P

here we go again:

where i can grab user session and get the time spent

i dont wanna put a simple counter on each page...
-------------------------------------------------
OH!
my boss just told me it would act just like any counter
//i tough it was for us only...

u know where u put a logo on you page and it does all the job...

but there s no standart for log files , so the admin can put it anywhere on the server so i guess i couldnt count on apache logs :s

so what is the best thing we could think about now?

im very confused now :P

panic

10:57 pm on Aug 6, 2003 (gmt 0)

10+ Year Member



Yeah... I think you confused yourself pretty bad there :P

I don't know of any Javascripts/etc that track the length of time visited, but you can kinda/sorta tell by taking a look at the logs. Sort them by IP

wkitty42

2:41 am on Aug 7, 2003 (gmt 0)

10+ Year Member



this appears to be one place where session cookies are desired... then you can use a "session log" that tracks the session cookies... in apache parlance, its called a "clickstream log"...

be warned, though, that this will negatively affect your "cacheability" factor because the cookie will be requested on every access... this means that AOL's proxys won't be able to cache your site for their aolers... there are also many providers that use squid and other caching proxies that won't be able to cache your pages... this is probably ok, though, as it'll ensure that you actually get the traffic to your site and not just to their caches...

i've implemented this in apache with the standard modules that come with it... how to do it on other servers, i have no idea...