Log-analytics : HTTP Error 500 with big Apache log file

OS version = CentOS 6.9
Matomo version = 3.5.1
PHP version = 5.6.37
MySQL version = 5.6.22

The “import_logs.py” tool stop with the error messages :

2018-08-22 13:56:46,693: [INFO] Error when connecting to Matomo: HTTP Error 500: Internal Server Error
2018-08-22 13:56:46,693: [INFO] Max number of attempts reached, server is unreachable!
Fatal error: HTTP Error 500 Internal Server Error, response: {“status”:“error”,“tracked”:60,“invalid”:0,“invalid_indices”:[]}
You can restart the import of “/data/download/http_access_op2.log” from the point it failed by specifying --skip=224929 on the command line.

In the Apache “error_log” file we find the error messages :

[Wed Aug 22 14:12:38 2018] [error] [client 128.23.8.72] Error in Matomo (tracker): Error query: SQLSTATE[22003]: Numeric value out of range: 1264 Out of range value for column ‘visit_total_interactions’ at row 1 In query: UPDATE matomo_log_visit SET idvisitor = ?, visit_last_action_time = ?, visit_exit_idaction_url = ?, visit_total_actions = visit_total_actions + 1 , visit_total_interactions = visit_total_interactions + 1 , visit_total_time = ? WHERE idsite = ? AND idvisit = ? Parameters: array ( 0 => ‘K\xa9E\xfd\x97Z\x1c\xe6’, 1 => ‘2018-08-17 13:05:09’, 2 => 33, 3 => 54310, 4 => 3, 5 => ‘12’, )

The imported log file is big and has 1309478 records …

Could you help me, please ?

Regards.

Does it work again if you do what the error message says?

I think it wont, because I’m pretty sure it has nothing to do with the number of records. It seems like the number of visits total interactions is bigger than the used data type (smallint(5)) can handle. @thomas_matomo can you have a look at this please?

You (@jfrancois) can confirm that this is the issue by running the following query against your Matomo database:

SELECT visit_total_interactions FROM matomo_log_visit WHERE idvisitor = 'K\xa9E\xfd\x97Z\x1c\xe6' AND idsite = 3 AND idvisit = 12

Maybe have a look at Numeric value out of range: 1264 Out of range value for column 'visit_total_interactions' · Issue #11722 · matomo-org/matomo · GitHub . This may fix your issue.

Thank you for your help.

I have modified the table definition, and now, the log import runs very well …

Regards.