Analytic Tool with AWS S3 -- Fatal error: Precondition Failed


#1

I am trying to get the Analytic Tool to work with S3 logs. After downloading the logs, I combine all the logs with


cat /tmplog/* > access.log

And then I called the following command


sudo python /vhosts/piwik/misc/log-analytics/import_logs.py --url=https://mybucket.s3-ap-southeast-1.amazonaws.com /home/ubuntu/s3logs/es_access.log --idsite=2 --log-format-name=s3

But I keep getting the following error


Fatal error: Precondition Failed

Any ideas?


#2

OK, I think I am missing the --token-auth= … but now I am getting a different error


Traceback (most recent call last):
  File "/vhosts/piwik/misc/log-analytics/import_logs.py", line 1691, in <module>
    resolver = config.get_resolver()
  File "/vhosts/piwik/misc/log-analytics/import_logs.py", line 601, in get_resolver
    return StaticResolver(self.options.site_id)
  File "/vhosts/piwik/misc/log-analytics/import_logs.py", line 946, in __init__
    'SitesManager.getSiteFromId', idSite=self.site_id
  File "/vhosts/piwik/misc/log-analytics/import_logs.py", line 928, in call_api
    return cls._call_wrapper(cls._call_api, None, None, method, **kwargs)
  File "/vhosts/piwik/misc/log-analytics/import_logs.py", line 917, in _call_wrapper
    raise Piwik.Error(message)
__main__.Error: Precondition Failed


#3

OK. Silly me … the --url parameter is for your Piwik installation URL. I thought it was for your S3 bucket address. Got that sorted out but it’s not putting in the data. I see some numbers in the command line, but in Piwik did not display anything. I want to track at least WEBSITE.GET.OBJECT which are like website hits.


#4

Actually, I want to be able to track

  • Downloads
  • Bandwidth

Any ideas how I can achieve these?


#5

That’s what I’m looking to do…any updates?


(Matthieu Aubry) #6

please comment in: Log Analytics: Monitor Bandwidth for each page, download, and measure overall traffic in bytes · Issue #5248 · matomo-org/matomo · GitHub