No, I am assuming that the message is coming from import_logs.py because of the error format. If that is what you mean. This is not a Windows OS error unless it bubbled from Windows. I am an administrator on the server and I used the administrator console.
You referred me to a location in the import_logs.py script which references a file called updatetoken.php which does not exist on my system. I don’t know what else to do to fix this issue. I have given the “Everyone” group in Windows read and write access to all the Piwik, Python and log file directories on the server.
I upgraded Piwik from 2.0.3 to 2.1.0 and ran the import_logs.py script with the same parameters as before and it said to use the idsite parameter so here are the results.
E:\Piwik\piwik\misc\log-analytics>import_logs.py --url=http://arf E:\logfiles2\I
ntranet\ARF_net_iis05\W3SVC769991110\ex140112.log --idsite=2
Traceback (most recent call last):
File “E:\Piwik\piwik\misc\log-analytics\import_logs.py”, line 1720, in <module
resolver = config.get_resolver()
File “E:\Piwik\piwik\misc\log-analytics\import_logs.py”, line 621, in get_reso
lver
return StaticResolver(self.options.site_id)
File “E:\Piwik\piwik\misc\log-analytics\import_logs.py”, line 966, in init
'SitesManager.getSiteFromId', idSite=self.site_id
File “E:\Piwik\piwik\misc\log-analytics\import_logs.py”, line 948, in call_api
I have also installed Piwik on a Windows 7 desktop I used the Web Platform Installer for Windows and I get the same error messages.
C:\Users\22015\Documents\My Web Sites\piwik\misc\log-analytics>import_logs.py --url=http://arf ex140112.log --idsite=1
Traceback (most recent call last):
File “C:\Users\22015\Documents\My Web Sites\piwik\misc\log-analytics\import_logs.py”, line 1720, in
resolver = config.get_resolver()
File “C:\Users\22015\Documents\My Web Sites\piwik\misc\log-analytics\import_logs.py”, line 621, in get_resolver
return StaticResolver(self.options.site_id)
File “C:\Users\22015\Documents\My Web Sites\piwik\misc\log-analytics\import_logs.py”, line 966, in init
’SitesManager.getSiteFromId’, idSite=self.site_id
File “C:\Users\22015\Documents\My Web Sites\piwik\misc\log-analytics\import_logs.py”, line 948, in call_api
return cls._call_wrapper(cls._call_api, None, None, method, **kwargs)
File “C:\Users\22015\Documents\My Web Sites\piwik\misc\log-analytics\import_logs.py”, line 937, in _call_wrapper
raise Piwik.Error(message) main.Error: Unauthorized
I ran into this very same problem and figure out a solution to the problem. The unauthorized is actually coming from the Piwik server and its because the token auth key isn’t being sent correctly. To fix this I had to put my api key in the command line for the import_logs.py script, using the attribute --token-auth. Once I did that it fixed my problem.
Using --token-auth on the command string did not work for me. This is not the real token_auth
C:\Users\22015\Documents\My Web Sites\piwik\misc\log-analytics>import_logs.py --url=http://arf ex140112.log --idsite=1 -
-token-auth=833232966857b71db867105f56153397
Traceback (most recent call last):
File “C:\Users\22015\Documents\My Web Sites\piwik\misc\log-analytics\import_logs.py”, line 1720, in
resolver = config.get_resolver()
File “C:\Users\22015\Documents\My Web Sites\piwik\misc\log-analytics\import_logs.py”, line 621, in get_resolver
return StaticResolver(self.options.site_id)
File “C:\Users\22015\Documents\My Web Sites\piwik\misc\log-analytics\import_logs.py”, line 966, in init
’SitesManager.getSiteFromId’, idSite=self.site_id
File “C:\Users\22015\Documents\My Web Sites\piwik\misc\log-analytics\import_logs.py”, line 948, in call_api
return cls._call_wrapper(cls._call_api, None, None, method, **kwargs)
File “C:\Users\22015\Documents\My Web Sites\piwik\misc\log-analytics\import_logs.py”, line 937, in _call_wrapper
raise Piwik.Error(message) main.Error: Unauthorized
Enable Anonymous authentication in your IIS … edit it and choose ‘Application Pool’ instead of a specific user. If this works then you can change the Anonymous authentication to the user of your choice.
PS. You can also enable anonymous authentication only to your piwik virtual directory.
I’ve tried running the command-line query both as root and as my apache user.
My site’s only accessible via https, I wonder if the problem is in there? My ssl cert is valid, but still. I’m running low on ideas.
--------- EDITED ---------
Sigh. So I guess following the order of command-line arguments as I saw them in some example documentation led me astray. If I put the file name to be imported as the last argument, then it seems to work… Actually, it fails, but in a reasonable, sane way. /facepalm. I’m leaving my post up to help others… I hope.