Content last modified Monday 6 March 2017
hop to #bottom
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.

Commenting is closed for this article.

Commented (6)

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?
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’]==’’ OR // SEVENtwentyfour
$out[‘ip’]==’my.ip.address’ OR // my ip address
strstr($out[‘host’],’’) OR // my domain
strstr($out[‘host’],’crawl’) OR
strstr($out[‘host’],’’) OR
substr($out[‘ip’], 0, 7) '207.46.' OR //
strstr($out['host'],'') OR
strstr($out['host'],'') OR
$out['ip']‘’ OR // Convera Corp
strstr($out[‘host’],’’) OR
$out[‘ip’]==’’ // United States – California – Livermore – Hurricane Electric

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.


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.




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