-
Problem report
-
Resolution: Unresolved
-
Trivial
-
None
-
None
-
None
-
None
-
Zabbix 6.0.1 installation
Steps to reproduce:
- Create an event log template like the one in the screenshot ("System log template").
Result:
Certain events will end up creating duplicate entries in the history_log table that will violate the primary key constraint introduced in Zabbix 6.0. The attached screenshot ("Duplicate rows in database") shows two rows that have the same itemid, clock, and ns value.
The timestamp field differs but this is not in the primary key that is part of the 6.0 upgrade: https://github.com/zabbix/zabbix/blob/master/database/postgresql/history_pk_prepare.sql
The screenshot is only one example but there are lots more examples in our database (Note that we upgraded from Zabbix 5.4 to 6.0 but did not alter history tables to include primary keys because of this issue with that constraint).
When I run:
SELECT itemid, clock, ns, COUNT
FROM history_log
GROUP BY itemid, clock, ns
HAVING COUNT > 1
ORDER BY clock DESC
I get 906 rows returned which all appear to be Windows event log items.
Expected:
Entires that would violate the primary key constraint should not be created. I am not sure what the usage of the timestamp field is but perhaps it could be added to the primary key constraint on this table to prevent these issues.