"Duplicate key value violates unique constraint" error

edited May 2015 in General
About two weeks ago we started to see a lot of errors of this nature in the regular windows logs. The error has been sporadic at best, not constant but when it happens there are several of them and then it'll go away for awhile again.

ERROR: duplicate key value violates unique constraint "idx_es_logontracking_unique"
DETAIL: Key (computername, username, start_unix, logonid)=({this info varies but there are some duplicates if I'm looking at it correctly}) already exists
STATEMENT: insert into eventsentry.ESLogonTracking (start_unix,start_datetime,computer name,group name,username,LogonID,SourceIP,SourceComputer,ComputerProductType,event number,RemoteDesktopState,incomplete,duration,LogonType,IsSession) values({again varies, fields from above match here})

While typing this up I thought of some other things I can look at to try and find some correlation between what is going on w/ the system. To be honest I'm not entirely sure it is an EventSentry error itself or something that has happened on the computer that EventSentry is trying to log. Has anyone seen these types of errors before though and know how we go about correcting them? So far everything seems to be working fine so I don't think they are fatal, but I'd prefer not to have them lingering around if they can be fixed… or at least know more about what they are.



  • Hello,

    This is a normal event with PostgreSQL and can be ignored. PostgreSQL is a little more verbose than SQL server so it will log these events whereas you wouldn't see them in SQL.

    In our default configuration we already have an exclude filter created for this event, which excludes these events from email.

    Have said that, we have tried to improve this so that they aren't logged. Could you please let me know what version of EventSentry you have installed? Are these events being sent to you via email? If so, could you look under "Event Logs > SQL Servers > PostgreSQL and see if you have a filter "EventSentry Database".

    If that filter is missing, you could create an exclude filter for these events referencing your email action with a wild card of:

    ERROR: duplicate key value violates unique constraint "idx_es_*

    This will exclude the events from being emailed to you but they will unfortunately still appear in the application log.

  • Thanks for the help/info. To answer your questions…

    - ES 3.1.1 Build 14
    - Not getting errors in email, just in the Window's logs (confirmed the filter is in place).
Sign In or Register to comment.