|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
1200+ fellow developers rate and compare features of the top IDEs, like Visual Studio, Eclipse, RAD, Delphi and others, across 13 categories. Enjoy this FREE Download of the IDE User Satisfaction Study by Evans Data Corporation. Download Now!
|
|
#1
|
||||
|
||||
|
Changing log file location on shared host
Hi,
Is it possible for me to change the location of the apache access log files on a shared host (ie using .htaccess files perhaps?)? We're using a host that doesn't backup it's log files til they reach 10MB(!) and attempting to read / check the files on a regular basis gets ridiculous after 1mb (I'm on a 56k link - no telnet access either). Ideally I'd like to use a PHP script I use on another server to read the log files in a browser, but this just isn't possible because of the size of the log. Thanks in advance, Jez
__________________
FreeBSD Admin Tips Tricks and Scripts |
|
#2
|
|||
|
|||
|
>> Is it possible for me to change the location....
No and it's impossible within .htaccess. >> We're using a host that doesn't backup it's log files til they reach 10MB Then just don't use that log file. Resource and bandwith is not a problem since you are not running your own server. So write a script and do your own logging. |
|
#3
|
||||
|
||||
|
Cheers freebsd,
You say write a script - you mean the type I could do in php to log all relevant info to db/file? ahhh (light goes on) ok I'll contemplate it in PHP. Any pointers/tips/experiences to share? |
|
#4
|
|||
|
|||
|
Check out env variables -> http://hoohoo.ncsa.uiuc.edu/cgi/env.html
Then check this -> http://httpd.apache.org/docs/mod/mo...ig.html#formats If there is no cap on your host, just log anything you want to plain-text or db and do all kind of nasty things and utilitize your server resource your account consumes per monthly fee that you pay. Just don't bog down the server. |
|
#5
|
||||
|
||||
|
Ahhh - looks familiar first link
k apache manual... yup do need to rtfm on logfiles... mmm just one thing - when you said 'write your own script' what did you have in mind? See I'm thinking I could jsut about manage it all in PHP but this might not be the fastest/easiest solution (don't want it to impact on the download time for a page request at the client end, plus the hassles of having to 'prepend' the logfile script to each file requested) - is there any other alternative at all apart from having a script execute on each and every request made for files on the server? |
|
#6
|
|||
|
|||
|
But you have no other alternatives. If you don't have access to httpd.conf, .htaccess can't do it. It must be done with your script, PHP or CGI doesn't matter.
>> the hassles of having to 'prepend' the logfile script to each file requested Your host probably is doing multiple logging mechanism anyway. So adding your own script and perform additional logging mechanism might not be too significant, unless your host has a poor system/backend in the first place. |
|
#7
|
||||
|
||||
|
Ok, thanks for that.
I think I'll create a php request logging script and have it called each time a request is made for any file on the site by setting the 'prepend_file' php.ini file option in the site's config include file (using ini_set()). Sounds like it might be doable without too much problem. Thanks for the advice. |
|
#8
|
||||
|
||||
|
Ok, all is going well with this custom log filer PHP script - up until the point where the apache log module would log the HTTP request status to the log file normally (200/304/404 etc).
Obviously I cannot get at the status information in the case that the request was anything other than '200' (since the script is only called/included if the request was successful). Any ideas on logging HTTP requests of status other than just success using custom scripting? Intuitively it doesn't seem it would be possible - is this the case? Or are there any hacks which might be applicable? Thanks in advance, Jez Last edited by munkfish : October 3rd, 2001 at 05:34 PM. |
|
#9
|
|||
|
|||
|
>> Obviously I cannot get at the status information in the case that the request was anything other than '200'
Why not? If your host allows you to use your customized ErrorDocument, then it's more than possible. Have you ever wondered why it's named ErrorDocument instead of HTTP_RESPONSE_STATUS_ROUTINE? It's just because you DON'T set 200 status to ErrorDocument in most case. But technically it's possible to set something like this: ErrorDocument 200 /path/to/error.php So just set up 304, 404, 403 or whatever with another script. |
|
#10
|
||||
|
||||
|
doh - of course - many thanks I'll get on and set it up.
|
![]() |
| Viewing: Dev Shed Forums > System Administration > Apache Development > Changing log file location on shared host |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|