Apache Help!

August 7th, 2016

http://forums.devshed.com/apache-development-15/how-to-stop-ads-being-logged-95579.html
I have the same exact type problem, but I have already searched on google groups I have found nothing.
What I want to do is prevent 127.0.0.1 from begging logged into my access.log file. Because I am using it to remove the annoying “Not Found” messages because I have my Hosts file blocking out advertisement sites. I know there is a simple code I can place inside my httd.conf file but I have been looking every where and I used to have the code but not anymore. The type of logs I am getting that I do not want are in the code below. Much appreciation for anyone that provides some type of help
127.0.0.1 - - [03/Jun/2009:02:16:17 -0500] "GET /st?ad_type=iframe&ad_size=728x90&section=327843 HTTP/1.1" 404 -
127.0.0.1 - - [03/Jun/2009:02:16:17 -0500] "GET /st?ad_type=iframe&ad_size=728x90&section=303868 HTTP/1.1" 404 -
127.0.0.1 - - [03/Jun/2009:02:16:17 -0500] "GET /ga.js HTTP/1.1" 404 -
127.0.0.1 - - [03/Jun/2009:02:17:13 -0500] "GET /pagead/show_ads.js HTTP/1.1" 404 -
127.0.0.1 - - [03/Jun/2009:02:17:13 -0500] "GET /send/164 HTTP/1.1" 404 -

Answer #1
Ok I found the solution.

  1. Locate CustomLog "logs/access.log" common and change it to CustomLog"logs/access.log" common env=!dontlog
  2. Create a txt file called robots.txt in the directory where your hosting your files. (Not sure if this is necessary but I did it )
  3. Paste the following code underneath Listen 80
    SetEnvIf Remote_Addr "127\.0\.0\.1" dontlog
    SetEnvIf Request_URI "^/robots\.txt$" dontlog
    CustomLog logs/combined.log combined env=!dontlog

  4. Go over to the apache server monitor thinga-ma-jig and stop the server
  5. File > Save on the httpd.conf file
  6. Start the server back up... if the server starts correctly then you should not get 127.0.0.1 in your access.log file anymore


Hope this helps some!

 

| Sitemap |