Actions
Bug #7638
closedmentat-statistician error after DST change
Start date:
03/27/2023
Due date:
% Done:
0%
Estimated time:
To be discussed:
No
Description
There was an error (or a couple of errors every 5 minutes to be precise) after changing to summer time.
2023-03-26 05:05:17,877 ERROR: (psycopg2.errors.UniqueViolation) duplicate key value violates unique constraint "ix_statistics_events_interval"
DETAIL: Key ("interval")=(2023-03-26T03:00:00_2023-03-26T03:05:00) already exists.
[SQL: INSERT INTO statistics_events (interval, dt_from, dt_to, delta, count, stats_overall, stats_internal, stats_external, createtime) VALUES (%(interval)s, %(dt_from)s, %(dt_to)s, %(delta)s, %(count)s, %(stats_overall)s, %(stats_internal)s, %(stats_external)s, %(createtime)s) RETURNING statistics_events.id]
[parameters: {'interval': '2023-03-26T03:00:00_2023-03-26T03:05:00', 'dt_from': datetime.datetime(2023, 3, 26, 3, 0), 'dt_to': datetime.datetime(2023, 3, 26, 3, 5), 'delta': 300.0, 'count': 8863, 'stats_overall': '{"cnt_events": 8863, "cnt_recurring": 0, "cnt_alerts": 8863, "ips": {"185.122.204.41": 1009, "152.89.198.133": 874, "185.11.61.195": 815, "185.122.20 ... (12409 characters truncated) ... .casablanca.nemea.blacklist/Nemea": 1, "cz.casablanca.nemea.blacklist/blacklistfilter": 1, "cz.cesnet.tmc.crowdsec/Crowdsec": 1}, "cnt_unique": 8863}', 'stats_internal': '{"cnt_events": 3417, "cnt_recurring": 0, "cnt_alerts": 3417, "ips": {"185.122.204.41": 1009, "152.89.198.133": 869, "185.11.61.195": 798, "185.122.20 ... (8115 characters truncated) ... a.blacklist/blacklistfilter": 3413, "cz.cesnet.nemea.bruteforce/Nemea": 4, "cz.cesnet.nemea.bruteforce/brute_force_detector": 4}, "cnt_unique": 3417}', 'stats_external': '{"cnt_events": 5446, "cnt_recurring": 0, "cnt_alerts": 5446, "ips": {
"__unknown__": 34, "185.11.61.195": 17, "156.96.45.164": 10, "104.156.155.5": 9, ... (7422 characters truncated) ... .casablanca.nemea.blacklist/Nemea": 1, "cz.casablanca.nemea.blacklist/blacklistfilter": 1, "cz.cesnet.tmc.crowdsec/Crowdsec": 1}, "cnt_unique": 5446}', 'createtime': datetime.datetime(2023, 3, 26, 3, 5, 17, 870610)}]
(Background on this error at: http://sqlalche.me/e/gkpj)
It didn't break anything, but I guess it will happen again in one year, or possibly after changing to standard time.
Files
Actions