Cannot get main URL of this site: invalid site id

Hello,

I have been running import_logs.py on my website for about 6 months now and starting on 3/26 the script failed with the following error:

$ sudo python import_logs.py --url=https://piwik.mydomain.com /var/log/mylogfile.log --idsite=1 --enable-http-errors --enable-http-redirects > /dev/null
Fatal error: cannot get the main URL of this site: invalid site ID: 1

I’m sort of at a lost as to why it would failed all of a sudden. I’ve verified that the siteid is correct (I only own one website) and to make sure it is not a piwik version problem I just upgraded to version 2.1.0. Both piwik and my website run on https and my access logs generate about 5mb of data daily.

Have anyone had this problem before and can someone suggest how I can fix this?

Any help is greatly appreciated!

Thanks

Julie

Please try the latest beta version where this bug may be fixed already: I would like to test early beta and RC releases, how do I enable automatic updates to use these development versions? - Analytics Platform - Matomo

Hi,

I realized I didn’t have the latest version of Piwik on my server to run import_logs.py, so I upgraded the install there as well. Now I’m getting a DB connection timed out error:

Fatal error: misc/cron/updatetoken.php failed: PHP Fatal error: Uncaught exception ‘PDOException’ with message ‘SQLSTATE[HY000] [2002] Connection timed out’ in /piwik/libs/Zend/Db/Adapter/Pdo/Abstract.php:129
Stack trace:
#0 /piwik/libs/Zend/Db/Adapter/Pdo/Abstract.php(129): PDO->__construct(‘mysql:host=p…’, ‘user’, ‘pwd’, Array)
#1 /piwik/libs/Zend/Db/Adapter/Pdo/Mysql.php(109): Zend_Db_Adapter_Pdo_Abstract->_connect()
#2 /piwik/core/Db/Adapter/Pdo/Mysql.php(51): Zend_Db_Adapter_Pdo_Mysql->_connect()
#3 /piwik/core/Db/Adapter.php(48): Piwik\Db\Adapter\Pdo\Mysql->getConnection()
#4 /piwik/core/Db.php(101): Piwik\Db\Adapter::factory(‘PDO_MYSQL’, Array)
#5 /piwik/core/Db.php(50): Piwik\Db::createDatabaseObject()
#6 /piwik/misc/cron/updatetoken.php(37): Piwik\Db::get()
#7 {main}

I have values set in my config.ini.php for host, username, password, dbname, tables_prefix, and charset. I tried adding in “adapter = PDO_MYSQL”, “adapter=MYSQLI” and “adapter=PDO_PGSQL” to no avail.

I’ve verified that connection to my database is working properly and the permissions have not changed since I installed Piwik months ago.

Any ideas?

Thanks!

Julie

It looks like a combination of upgrading piwik and updating my database’s security settings fixed the issue. Whew!