Log analytics imports server ip address instead of client's ip address

I am running piwik 2.14.3 / Debian 7 / Python 2.7 / Apache 2.2.22
Piwik, website and log analytics are running on the same server, which IP is

This is the import command:

/usr/bin/python /var/www/piwik/misc/log-analytics/import_logs.py --url=https://MINEPIWIK.com --idsite=5 --recorders=4 --enable-http-errors --enable-http-redirects --enable-static --enable-bots  /var/log/apache2/access.log

This is apache log format:

%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"

This is an example of a log line:

MINEWEBSITE.com - - [02/Oct/2015:10:54:49 -0300] "GET /Global/Imagens/ic_chama.png HTTP/1.1" 200 1175 "http://MINEWEBSITE.com/" "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36"

See image attached, the only IP that shows is (server’s IP) instead of (client’s IP).
What is wrong?

in your config file did you customise the Proxy headers, or not? How do I configure Piwik when the server is installed behind a proxy? - Analytics Platform - Matomo

If you haven’t customised these INI settings I’m not sure what could be the issue. Maybe it’s best if you create a bug report at: Issues · matomo-org/piwik-log-analytics · GitHub with your steps to reproduce

Thanks Matt.
Piwik is running on the reverse proxy server itself.
I tried configuring it like this:

assume_secure_protocol = 1
; Uncomment line below if you use a standard proxy
proxy_client_headers[] = HTTP_X_FORWARDED_FOR
proxy_host_headers[] = HTTP_X_FORWARDED_HOST

but it didn’t work

I reinstalled piwik and now it works fine.

i have the same issue. can anyone tell me how to solve?


every ip shows as my server ip. why is this?

I have the same issue. I use a setup based on the official Docker images.

My setup:

[docker: matomo] <-fcgi- [host: nginx] <-https- internet

I currently use the matomo:3.11-fpm-alpine image. As data source I use the import script through an external docker container as suggested by the official Matomo image docs:

sudo docker run --rm \
    --volumes-from="matomo_web" --link matomo_web \
    -v /var/log/nginx:/var/log/nginx:ro python:2-alpine \
    python /var/www/html/misc/log-analytics/import_logs.py \
        --url=<my-public-url> --log-format-name=ncsa_extended (...) \

When I import logs like that, even though the IP is in the nginx logfile, the IP that shows up is, which is the internal IP of the temporary Docker container.

Any ideas?

Oh, I just found the issue! When importing, it’s important that the token auth method is being used, and that the auth token belongs to a superuser.

import_logs.py ... --token-auth=<your-superuser-token>

Otherwise the import still works, but the IP cannot be overwritten.