'FluentD: RecordNotUnique error="TinyTds::Error: Violation of PRIMARY KEY constraint
We have added fluent for logging in SQL database. It works fine for unique records. It is showing an error when there is a primary key in the table and fluentd tries to insert a duplicate value. Now from the programming side, I do not have a way to restrict duplicate entries in the buffer file. I want a way to validate the primary key column if the same value has already been inserted or not. This issue creates overhead on DB on every exception.
Serlog is being used to create log buffer files.
I am using Fluent 4.1.1 and SQL 2017.
Below is the error I am seeing in fluentd log file:
2022-02-09 16:25:47 +0530 [error]: #0 Got deterministic error again. Dump a record error_class=ActiveRecord::RecordNotUnique error="TinyTds::Error: Violation of PRIMARY KEY constraint 'PK_mio_LogMessageDetails'. Cannot insert duplicate key in object 'MIO_Sch.mio_LogMessageDetail'. The duplicate key value is (a1a4eb93-5482-461e-8358-7fb6b68f5c96)." record=#<#<Class:0x000001d3681ba980> MessageId: "a1a4eb93-5482-461e-8358-7fb6b68f5c96", TimestampUtc: "2022-02-09 10:55:41.218377000 +0000", RequestId: "", Name: "sample_webapi_adapter4010 6a1a4eb93-5482-461e-8358...", MessageType: "dd_webapi", ChannelSource: "miochannelsource", ChannelAdapter: "miotestadapter", MessageChannel: "miotestchannel", Status: nil>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
