Categories:
Author:
About It:
Rate it:
Flag it:
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.
Posted here:
05 Jun 2005Article modified:
05 Jun 2005









Comments/questions? Leave a message in the form.
Commented (6)
I see line 37,38 and 39 – but where do paste you code exactly?
Thanks
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.
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?