Forum Moderators: phranque

Message Too Old, No Replies

Apache log hadling

Is it possible to deny certain files be written in log?

         

Moby_Dim

9:32 am on Nov 14, 2004 (gmt 0)

10+ Year Member



I want to know whether it is possible to restrict some files (by extensions) be written in Apache log files? Suppose, I want to get rid of all images requests? Thanx.

dmorison

8:43 pm on Nov 14, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi,

This is covered in the Apache documentation. Have a look at this page:

[httpd.apache.org...]

The section you want is almost at the end of the page - "Do not log requests for images in the access log"

Moby_Dim

3:02 pm on Nov 15, 2004 (gmt 0)

10+ Year Member



Thank you, dmorison.

My question was not perfect btw. I do meant how to do this without server owner (hoster) help. He do not want to do this forcing me to shift to more expensive plan. The trafic is growing, logs are growing too "eating" disk space completely, and this results in statistics absence until log rotates :(. I've partially resolved the problem yesterday by uniting all navigation menu images in one img (let this works as an img MAP - less urls - smaller log file ;)

jdMorgan

4:35 pm on Nov 15, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You will probably need to switch to a dedicated server hosting plan in order to get custom logging control -- Custom logging must be set up at the server config level.

I assume you've already made sure your images are marked as cacheable, so that return visitors won't usually have to re-load images.

Jim

Moby_Dim

8:39 am on Nov 16, 2004 (gmt 0)

10+ Year Member



wow, jdMorgan... Thanx a lot :) I guess you mean of ExpiresByType directive? Never before i thought about this - the topic seems to be a discovery for me. Thx.

jdMorgan

4:13 pm on Nov 16, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



ExpiresByType is one way to do it.

Another way is more complex, but gives finer control. Here's an example:


# Set up Cache Control headers
ExpiresActive On
# Default - Set http header to expire everything 2 weeks from last access, set must-revalidate
ExpiresDefault A604800
Header append Cache-Control: "must-revalidate"
# Apply a customized Cache-Control header to "special" and frequently-updated files
<FilesMatch "^(test[0-9]?¦404¦410¦403[a-z]?)\.html$">
ExpiresDefault A1
Header set Cache-Control: "no-cache, must-revalidate"
</FilesMatch>
<FilesMatch "^(calendars¦ev_sched)\.html$">
ExpiresDefault A14400
</FilesMatch>
<FilesMatch "^index\.htm">
ExpiresDefault A7200
</FilesMatch>
<FilesMatch "^co_style\.css$">
ExpiresDefault A7200
</FilesMatch>
<FilesMatch "^robots">
ExpiresDefault A7200
</FilesMatch>

The Header set, unset, and append can be used to set arbitrary headers. The headers must be formatted correctly, since the Header directive won't "check" them in any way; If the header isn't correct, the only indication you'll have (if any) is mis-operation of the client browser or user-agent.

Change all broken pipe "¦" characters above to solid pipes before use -- posting on this board modifies them.

Jim

Moby_Dim

7:04 pm on Nov 16, 2004 (gmt 0)

10+ Year Member



I've implemented the first scenario, and it works fine now ;)

I'll try the second one too, of course (just to experiment for the first time.) Thanx again.

I wonder whether something like of "Complete .htaccess manual for those who has not admin permissions" exists somewhere or not in the Net?