Matomo version: 5.14.0
First time setting up import_logs.py, and running via cron . Compared to the polish and refinement of the online side, the script side is very basic!
I’m getting the errors shown below while running import_logs.py. I turned debug on, but still it’s not clear what the issue is.
2026-09-28 16:54:01,926: [DEBUG] Accepted hostnames: all
2026-09-28 16:54:01,926: [DEBUG] Matomo Tracker API URL is: https://[redacted]/matomo/index.php
2026-09-28 16:54:01,927: [DEBUG] Matomo Analytics API URL is: https://[redacted]/matomo/index.php
2026-09-28 16:54:01,927: [DEBUG] Authentication token token_auth is: [redacted]
2026-09-28 16:54:01,927: [DEBUG] Resolver: static
2026-09-28 16:54:02,654: [DEBUG] Request redirected (code: 302) to 'https://[redacted]/matomo/index.php'
Traceback (most recent call last):
File "/[redacted]/matomo/misc/log-analytics/import_logs.py", line 1884, in _call_api
return json.loads(res)
File "/usr/lib64/python3.9/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/lib64/python3.9/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib64/python3.9/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/[redacted]/matomo/misc/log-analytics/import_logs.py", line 2986, in <module>
resolver = config.get_resolver()
File "/[redacted]/matomo/misc/log-analytics/import_logs.py", line 1427, in get_resolver
return StaticResolver(self.options.site_id)
File "/[redacted]/matomo/misc/log-analytics/import_logs.py", line 1959, in __init__
site = matomo.call_api(
File "/[redacted]/matomo/misc/log-analytics/import_logs.py", line 1943, in call_api
return self._call_wrapper(self._call_api, None, None, method, **kwargs)
File "/[redacted]/matomo/misc/log-analytics/import_logs.py", line 1895, in _call_wrapper
response = func(*args, **kwargs)
File "/[redacted]/matomo/misc/log-analytics/import_logs.py", line 1886, in _call_api
raise urllib.error.URLError('Matomo returned an invalid response: ' + res.decode("utf-8") )
AttributeError: 'str' object has no attribute 'decode
My invocation looked like this:
python3 /[redacted]/matomo/misc/log-analytics/import_logs.py \
--url=https://[redacted]/matomo/index.php \
--idsite=1 \
--debug \
--auth-config=/[redacted]matomo_auth.cfg \
/[redacted]/[log file]