Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2005-08-25 06:35:29

Andrew
Plugin Author
Registered: 2004-02-23
Posts: 730

Re: HowTo: Remove hits from your current IP from the logs

Ah, I was looking at a later revision (i.e. /development/4.0/). You’ve probably got something like this, and if that’s the case then just place the previously-suggested changes just before these lines:

<pre> if ($r==‘refer’) { if (trim($out[‘ref’]) != “”) { insert_logit($out); } } else insert_logit($out);
</pre>

Offline

#14 2005-08-25 06:47:18

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: HowTo: Remove hits from your current IP from the logs

Thanks, I’ll give it a go later, have to go to work now :(

Offline

#15 2005-08-25 13:40:18

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: HowTo: Remove hits from your current IP from the logs

Well, apparently since I added the line of code this morning there were no visits logged at all, and when I wanted to view my site all I got was a parse error :(
This disappeared after I changed this
if (in_array($out['ip'], array( 'ipname1.com','ipname2.com','ipname3.com')) return;

to this
if (in_array($out['ip'], array( 'ipname1.com','ipname2.com','ipname3.com'))) return;

I hope that was the right thing to do…

Offline

#16 2005-08-25 15:08:55

Andrew
Plugin Author
Registered: 2004-02-23
Posts: 730

Re: HowTo: Remove hits from your current IP from the logs

That looks right to me. Test it out and let me know how it goes.

Offline

#17 2005-08-25 20:09:44

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: HowTo: Remove hits from your current IP from the logs

So far I don’t see any more googlebot.com (that was flooding my logs for the last week) so I suppose it’s working?

One more question: I also see a lot of IP numbers that always start on page robots.txt (that btw doesn’t exist). I assume these are crawlers too, can I also add these to the array or can that be only IP names like googlebot.com?

Offline

#18 2005-08-25 20:20:21

Andrew
Plugin Author
Registered: 2004-02-23
Posts: 730

Re: HowTo: Remove hits from your current IP from the logs

The reason why those are getting logged is because that file doesn’t exist, so the request gets funneled through index.php (in later stable releases this will be resolved; it actually already is in current development versions).

If you add an empty robots.txt file to your document root, that would also take care of the problem. Having an empty robots.txt file is perfectly acceptible.

Last edited by Andrew (2005-08-25 21:48:16)

Offline

#19 2005-08-25 20:47:10

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: HowTo: Remove hits from your current IP from the logs

Thank you for clarifying! I found my visitor logs were becoming a bit meaningless with all these robots’ visits ;) I now added an empty robots.txt file to the root.

Offline

#20 2005-08-28 22:02:41

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: HowTo: Remove hits from your current IP from the logs

Well, this line

<code>if (in_array($out[‘ip’], array( ‘googlebot.com’,‘inktomisearch.com’,‘ask.com’))) return;</code><br />
is not working. I suppose it’s because it’s not the full domain (like crawl-66-249-66-34.googlebot.com), but that’s not possible because the first part varies. Is it possible to use *.domain.com in the code?

Offline

#21 2005-08-29 03:46:05

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: HowTo: Remove hits from your current IP from the logs

This is just off the top of my head.

<pre><code>$ignore = array( ‘googlebot.com’, ‘inktomisearch.com’, ‘ask.com’
);

foreach ($ignore as $ip)
{ if (stristr($ip, $out[‘ip’])) { return; }
}</code></pre>

Does it work?

(Edit: updated to use correct code for any passers-by.)

Offline

#22 2005-08-29 13:56:16

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: HowTo: Remove hits from your current IP from the logs

In Production Status: testing:

Warning: Invalid argument supplied for foreach() in /home/httpd/vhosts/doggiez.nl/httpdocs/textpattern/publish/log.php on line 49

Offline

#23 2005-08-29 14:19:38

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,122
Website GitHub Mastodon Twitter

Re: HowTo: Remove hits from your current IP from the logs

sencer, this is cool staff. Maybe it could be incorporated in txp as a new log administration tab (I know this comment should be in the feature requests)


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#24 2005-08-29 15:54:56

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: HowTo: Remove hits from your current IP from the logs

I’m so ignorant I’ll do whatever you say ;) This time (only in debugging status):

Notice: Array to string conversion in /home/httpd/vhosts/doggiez.nl/httpdocs/textpattern/publish/log.php on line 49

Last edited by doggiez (2005-08-29 15:55:44)

Offline

Board footer

Powered by FluxBB