Jump to content


Photo

internal ip logging


  • Please log in to reply
1 reply to this topic

#1 tripstar1976

tripstar1976
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 07 September 2006 - 01:34 AM

Hi

Is there any way to stop internal/network ips from being logged?

Thanks

#2 R_P

R_P
  • Members
  • PipPipPip
  • Advanced Member
  • 98 posts

Posted 07 September 2006 - 02:28 AM

Yep, the buzz words you need to search for here are: conditional logging in apache. Here's a great reference. It uses apache mod_setenvif by the way:

http://www.serverwat...10825_3376671_2

Assuming that internal IP's will be of the 192.168.xxx.xxx type, I believe something like this would work:


SetEnvIf Remote_Addr ^192\.168\. internal_IP
CustomLog logs/access.log combined env=!internal_IP


What this basically does is instanciate an "internal_IP" environmental rule if the IP starts with "192.168." which is then evaluated after the custom log directive.  If internal_IP exists, it will suppress logging. I actually do this with a number of my scripts called by AJAX. Comes in pretty handy.

Have fun.
Pro in: Win2K3S | Apache2 | PHP5 | Perl5 | MySQL | MSSQL | Firefox | Photoshop
Student of: Ubuntu6 | Java | C | VB.NET | ASP.NET
Developer: Roddzilla Webstudios, Burrson CG, DVIDSHUB, The Four Nations
Student: Georgia Tech, Georgia Tech College of Computing




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users