Forum Moderators: DixonJones

Message Too Old, No Replies

Filter apache logs

exclude all except google images

         

cyrilb

9:34 am on Jul 21, 2009 (gmt 0)

10+ Year Member



Dear all,

I want to exclude all hits from access log except the hits of the googlebot image user agent?

I am completly lost with the setenv in Apache, please, could you help me?

Cheers,

cyrilb

unilytics

5:18 pm on Jul 21, 2009 (gmt 0)

10+ Year Member



Here's a starting point: (OTTOMH)

SetEnvIf HTTP_USER_AGENT "Googlebot-Image" dolog
CustomLog logs/googlebot-image_log common env=dolog

If that doesn't fully work, can you paste the relevant Apache log directive section from your current configuration as well as some sample data which you are testing against?

cyrilb

12:21 pm on Jul 22, 2009 (gmt 0)

10+ Year Member



Well, this is what i did in my httpd.conf :

ErrorLog logs/error_log
LogFormat "%h %l %u %t \"%r\" %>s %b" common
SetEnvIf HTTP_USER_AGENT "Googlebot-Image" dolog
CustomLog logs/googlebot-image_log common env=dolog

But i cannot see any hits from google image for now.

unilytics

9:34 pm on Jul 22, 2009 (gmt 0)

10+ Year Member



Have you verified that Googlebot-image data is in your log file?

Try the following command from a shell if you are using a Linux shell


grep Googlebot-Image somefile ¦ wc -l

If you see output of a number greater than 0, then if possible can you forward a copy of your httpd.conf file?

cyrilb

1:13 pm on Jul 24, 2009 (gmt 0)

10+ Year Member



Hello unilytics and thx for your answers.
I haven't actived acces log in this server because the access log should grow too much.

I cannot see any output with this configuration, if you have any idea... My httpd.conf is so basic, nothing special in there, but this is my config.nice:

# Created by configure

"./configure" \
"--prefix=/usr/local/apache" \
"--with-mpm=worker" \
"--disable-so" \
"--disable-cgi" \
"--disable-dav" \
"--disable-ssl" \
"--enable-log_config" \
"--enable-setenvif" \
"--disable-autoindex" \
"--disable-asis" \
"--disable-actions" \
"--disable-userdir" \
"--disable-alias" \
"--enable-headers" \
"--enable-rewrite" \
"$@"

unilytics

12:12 am on Jul 25, 2009 (gmt 0)

10+ Year Member



Could you temporarily turn on your access log and see if Googlebot-Image is actually visiting your site?

Can you also try SetEnvIf on other parameters that you know are working? (common user Agents, etc.)