Content last modified Monday 6 March 2017
hop to #bottom
Categories:
Author:
Andrew
About It:
Rate it:
  • Helpful?
  • 0 Yes
  • 0 No
Flag it:

If you'd like to provide updated information and do not have access to directly edit, please contact the site admin; thanks!

Disable logging for your home IP.

I got sick of seeing my home IP address in the logs (usually more of them than anything else). Changed a couple of lines in textpattern/publish/log.php and now my logs almost never change.

Wrap lines 37, 38, 39 in another if/then like this:

if ($out['host'] != "[enter your IP address here]"){
  if ($r=='refer') {
    if (trim($out['ref']) != "") { insert_logit($out); }
  } else insert_logit($out);
}

Now assuming you have a static IP address at home (like my cable modem which is allegedly DHCP but hasn’t changed in over a year) then you will never see yourself in your logs again.

Article Request Count:
Posted here:
05 Jun 2005
Article modified:
05 Jun 2005

Comments/questions? Leave a message in the form.

Your comment will NOT be submitted until you click the 'Submit' button on the next pageload.

Commented (6)

NeilA:
This would be great to use – but being a PHP dummy, can you explain a little more about where your code goes?
I see line 37,38 and 39 – but where do paste you code exactly?
Thanks
yooseg:
how to add 2 hosts? two loops?
I did the same kind of job, in order to see in the log only physical people. In inserted on line 38 (just before “if ($r==’refer’) {”) the followings :

if ($out[‘ip’]==’209.167.50.22’ OR // SEVENtwentyfour
$out[‘ip’]==’my.ip.address’ OR // my ip address
strstr($out[‘host’],’my.domain.com’) OR // my domain
strstr($out[‘host’],’crawl’) OR
strstr($out[‘host’],’inktomisearch.com’) OR
substr($out[‘ip’], 0, 7) '207.46.' OR // msnbot.msn.com
strstr($out['host'],'msnbot.msn.com') OR
strstr($out['host'],'attens.net') OR
$out['ip']‘63.241.61.8’ OR // Convera Corp
strstr($out[‘host’],’exabot.com’) OR
$out[‘ip’]==’65.19.150.242’ // United States – California – Livermore – Hurricane Electric
)
return;

In fact it would be great if we could manage this kind of filter over logging into Textpattern, and also see the log in a “group by host” style.
where do i insert it? i tried inserting it before “if ($r==’refer’) {” but it still wouldn’t work? can this be used throughout all textpattern versions?
In order to add several IP adresses, just edit the first line:

if ($out[‘host’] != ”[enter your IP address here]” OR $out[‘host’] != ”[enter another IP address here]”){
if ($r==’refer’) {
if (trim($out[‘ref’]) != “”) { insert_logit($out); }
} else insert_logit($out);
}

If you see the pattern, you can add as many addresses as you want. Just add ” OR $out[‘host’] != ”[IP]” ” to the if.

Great tip, but $out[‘host’] should be $out[‘ip’], since you want to exclude an IP address not a hostname.

Cheers

Subscribe to this article's comments RSS feed. [ ? ]   View Recent Comments across the site.

Would you care to write a comment?

You know you want to visit the Archives.

Browse

Categories


Articles

There are also tag clouds, 'cause those are fun.
Published with Textpattern