Apache: Tracking down where "File does not exist" is called from

Apache: Tracking down where "File does not exist" is called from

Post by Alex Brow » Sat, 05 Feb 2000 04:00:00




> Our apache error log is giving us some "File does not exist" messages.
> I know which file doesn't exist and why - this relative link is wrong,
> but I can't find out which page on our site is calling it. Is there
> anything that we can switch on to get Apache to also log the name of
> the calling page?

If you change your logformat to include the referrers (ie use combined
format), then you can look through your access logs and see which page is
sending your users there.

Beware though you will suffer a performance hit as it has to log extra
infomation to your logs, and your logs will get bigger quicker, so you
will wish to bear this in mind.

HTH.

Alex.

--
Alex Brown
www.kama-sooty.co.uk
sootycam.kama-sooty.co.uk

 
 
 

Apache: Tracking down where "File does not exist" is called from

Post by Trevor Wo » Sat, 05 Feb 2000 04:00:00


Our apache error log is giving us some "File does not exist" messages.
I know which file doesn't exist and why - this relative link is wrong,
but I can't find out which page on our site is calling it. Is there
anything that we can switch on to get Apache to also log the name of
the calling page?

Cheers

 
 
 

Apache: Tracking down where "File does not exist" is called from

Post by Paul Rub » Sat, 05 Feb 2000 04:00:00




>Our apache error log is giving us some "File does not exist" messages.
>I know which file doesn't exist and why - this relative link is wrong,
>but I can't find out which page on our site is calling it. Is there
>anything that we can switch on to get Apache to also log the name of
>the calling page?

Yes, log the referer header.  See the CustomLog directive.
 
 
 

Apache: Tracking down where "File does not exist" is called from

Post by Trevor Wo » Sat, 05 Feb 2000 04:00:00



Quote:>Yes, log the referer header.  See the CustomLog directive.

Thanks, I'll pass both of these onto our UNIX administrator
 
 
 

Apache: Tracking down where "File does not exist" is called from

Post by Rhug » Sun, 06 Feb 2000 04:00:00



How about trying a grep of the web directories for the filename. I do
this often.

grep -in "string" /usr/local/apache/htdocs/*.htm* (for files in
htdocs)
grep -in "string" /usr/local/apache/htdocs/*/*.htm* (for all
directories directly under htdocs) and so on.

This will print every occurence of "string" and print the line number
it appears on in each file.

Replace "string" with enough of the name of the missing file to
provide unambiguity. (ex: if the missing file is
some_missing_file.html, try grep -in "some_missing" /path/*, this will
show you all pages (files) referring to this bad URL)

-Chuck

Quote:>Our apache error log is giving us some "File does not exist" messages.
>I know which file doesn't exist and why - this relative link is wrong,
>but I can't find out which page on our site is calling it. Is there
>anything that we can switch on to get Apache to also log the name of
>the calling page?

>Cheers

 
 
 

Apache: Tracking down where "File does not exist" is called from

Post by Trevor Wo » Tue, 08 Feb 2000 04:00:00





>How about trying a grep of the web directories for the filename. I do
>this often.

>grep -in "string" /usr/local/apache/htdocs/*.htm* (for files in
>htdocs)
>grep -in "string" /usr/local/apache/htdocs/*/*.htm* (for all
>directories directly under htdocs) and so on.

>This will print every occurence of "string" and print the line number
>it appears on in each file.

>Replace "string" with enough of the name of the missing file to
>provide unambiguity. (ex: if the missing file is
>some_missing_file.html, try grep -in "some_missing" /path/*, this will
>show you all pages (files) referring to this bad URL)

>-Chuck

>>Our apache error log is giving us some "File does not exist" messages.
>>I know which file doesn't exist and why - this relative link is wrong,
>>but I can't find out which page on our site is calling it. Is there
>>anything that we can switch on to get Apache to also log the name of
>>the calling page?

>>Cheers

 I've tried that on the NT box that we do the development on,
unfortunately it throws up either zero or hundreds of potential hits
for each of the errors. I've corrected some that I've found but I have
a particularly tricky one. It probably has multiple new lines in it
which I can't find a way to allow for.
 
 
 

Apache: Tracking down where "File does not exist" is called from

Post by Bill Mosele » Tue, 08 Feb 2000 04:00:00


On Mon, 07 Feb 2000 09:19:39 GMT Trevor Wood

Quote:> >grep -in "string" /usr/local/apache/htdocs/*.htm* (for files in
>  I've tried that on the NT box that we do the development on,
> unfortunately it throws up either zero or hundreds of potential hits
> for each of the errors. I've corrected some that I've found but I have
> a particularly tricky one. It probably has multiple new lines in it
> which I can't find a way to allow for.

Use perl?  File::Find to traverse the director structure, and perl's
regular expressions are flexible.

What happened with the 'log referers' suggestion that was offered?

--

pls note the one line sig, not counting this one.

 
 
 

Apache: Tracking down where "File does not exist" is called from

Post by Trevor Wo » Tue, 08 Feb 2000 04:00:00




Quote:>What happened with the 'log referers' suggestion that was offered?

waiting for our UNIX administrator to decide whether he wants to
implement it