Problem with showing IP addresses

Hi there,

I’m running Piwik 1.4 and it is a great piece of software! But a few days ago I noticed, that IP addresses in all logs are only shown in the way like

IP: 55e9:14cf::

That seems to be a IPv6 format but the address itself doesn’t make any sense. Does anybody know this phenomen? Is there any problem in my installation of Piwik? I read that with version 1.4 came the IPv6 support. So is that the reason for this error? But when it’s so, why doesn’t Piwik show IPv4 addresses anymore?

I am looking forward to any help. This is so annoying because some of my customers are asking to fix this bug again and again… :frowning:

Thanks for your help! :wink:

I guess this is a anonymized adress …

But who or what does that? The plugin AnonymizeIP is turned off!

meanwhile I’ve read the german article at wikipedia … so it seems, the last blocks of the adress consists only of zero digits …

Can you post a link to that article?

PM your piwik url+login and ftp host+login. We’ll take a look.

german wikipedia:

I am also having problems with this whilst running piwik 1.4. Itseems very odd to me. Any ideas?

Since IPv6 is still not very widely supported, this does seem odd indeed, most US ISP’s have not even thought of IPv6 assignment.

However… In my opinion Piwik should work both ways. But the phenomen stated above with this “crazy” IPv6 addresses shown in the logs appears since the upgrade to 1.4. Before that everything works fine. So it doesn’t seem to be a problem of the ISP.

I really hoped that Anthon could tell me more about this problem. :frowning:

I’ve already fixed the issue on styloweb’s site. It appears to be a MySQL migration problem (e.g., from 4.1 to 5.0) where some MySQL internals are set to wonky values … thus, confusing PHP’s mysql driver. For example, in styloweb’s table, IP addresses in earlier visits were right padded with spaces, while IP addresses were right padded with nulls in newer visits.

The only difference I saw in the schema was that location_ip’s column definition is

VARBINARY(16) NOT NULL DEFAULT '                '


Note: The following can take some time to execute (depending on the number of rows in your log_visit table)…

Redefine the column (again).

ALTER TABLE piwik_log_visit CHANGE location_ip location_ip VARBINARY(16) NOT NULL;

Truncate the ip addresses to 4 bytes.

UPDATE piwik_log_visit SET location_ip=SUBSTRING(location_ip, 1, 4)
    WHERE HEX (SUBSTRING(location_ip, 5)) = '202020202020202020202020' OR
                  HEX (SUBSTRING(location_ip, 5)) = '000000000000000000000000';

(If you only have visitors from IPv4 addresses, you can omit the WHERE clause.)

Absolutely great! Thank you very much, Anthon. That’s the solution of the problem. I never would have found this! I’m very happy now and I’ll follow the wishes of your signature. I’ll buy you a beer and show you some love… Thanks again! :wink: