Add userid from Logs to piwik


#1

Hi,
I am new to piwik. Can anyone suggest me the correct log format to import apache logs. Please find the below sample logs.
user agent values are getting displayed in piwik but not the custom variable,resolution and userid.

127.0.0.1 - - [24/Mar/2014:05:58:10 +0000] “GET /piwik.php?url=http%3A%2F%2Fwww.domain.me%2Fsearch%2Fsearch&urlref=http%3A%2F%2Fwww.mydomain.me%2Fsearch%2F&uid=SampleUser&cvar=%7B%221%22%3A%5B%22SEARCH_STATUS%22%2C%22OK%22%5D%7D HTTP/1.1” 200 54 “-” “Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.116 Safari/537.36”

Command what i used is:

python import_logs.py --url=http://localhost/piwik --idsite=1 --enable-http-errors --show-progress --enable-bots recorders=2 /var/tmp/testlog_New.log

Thanks in advance.


(Matthieu Aubry) #2

Hi there,

What error message did you get?

The apache logs should be imported automatically and the log format detected.


#3

Hi matt,
I am not getting any error. But i am not seeing any values in UI. Please find the below console.

/var/www/html/piwik/misc/log-analytics > sudo python import_logs.py --url=http://localhost/piwik --idsite=1 --enable-http-errors --show-progress --enable-bots recorders=2 /var/tmp/testlog_New.log
0 lines parsed, 0 lines recorded, 0 records/sec (avg), 0 records/sec (current)

=====> Warning: File recorders=2 does not exist <=====
Parsing log /var/tmp/testlog_New.log…
1 lines parsed, 1 lines recorded, 0 records/sec (avg), 1 records/sec (current)

Logs import summary

1 requests imported successfully
0 requests were downloads
0 requests ignored:
    0 HTTP errors
    0 HTTP redirects
    0 invalid log lines
    0 requests did not match any known site
    0 requests did not match any --hostname
    0 requests done by bots, search engines...
    0 requests to static resources (css, js, images, ico, ttf...)
    0 requests to file downloads did not match any --download-extensions

Website import summary

1 requests imported to 1 sites
    1 sites already existed
    0 sites were created:

0 distinct hostnames did not match any existing site:

Performance summary

Total time: 1 seconds
Requests imported per second: 0.99 requests per second

(Matthieu Aubry) #4

can you try running the ./console core:archive command ?

Not sure what else could be the problem, it should work :wink:


#5

You are missing the minus sign before “recorders=2” and the python script is puking on that.

-Kyle