Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when importing Apache combined #344

Open
liubinas opened this issue Jan 24, 2023 · 1 comment
Open

Error when importing Apache combined #344

liubinas opened this issue Jan 24, 2023 · 1 comment

Comments

@liubinas
Copy link

Python 3.6.8
Matomo version: 4.13.1
Trying to import standard Apache combined log. Log directive from httpd conf:
CustomLog /var/log/httpd/site.com/access.log combined

Command:
./import_logs.py --url=site.com --idsite=9 /var/log/httpd/site.com/access.log

Error:

Traceback (most recent call last):
  File "./import_logs.py", line 1588, in _call_api
    return json.loads(res)
  File "/usr/lib64/python3.6/json/__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "/usr/lib64/python3.6/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib64/python3.6/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 4 column 1 (char 6)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./import_logs.py", line 2688, in <module>
    resolver = config.get_resolver()
  File "./import_logs.py", line 1131, in get_resolver
    return StaticResolver(self.options.site_id)
  File "./import_logs.py", line 1664, in __init__
    'SitesManager.getSiteFromId', idSite=self.site_id
  File "./import_logs.py", line 1647, in call_api
    return self._call_wrapper(self._call_api, None, None, method, **kwargs)
  File "./import_logs.py", line 1599, in _call_wrapper
    response = func(*args, **kwargs)
  File "./import_logs.py", line 1590, in _call_api
    raise urllib.error.URLError('Matomo returned an invalid response: ' + res.decode("utf-8") )
AttributeError: 'str' object has no attribute 'decode'
@tixif
Copy link

tixif commented Feb 1, 2023

I had the same problem, and in facts it's not a problem...

The --url-site parameter needs to point to your matomo base url...

From the doc :
The only required parameter is
--url=https://analytics.example.com
To specify the Matomo (Piwik) base URL. Then, you can specify one or many log files to import.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants