Splunk Search

Splunk DB connect: How to avoid output duplicate data into database?

amoswuchi
Loves-to-Learn Lots

I am using Splunk DB connect to push my data from Splunk to oracle database. However, I can't not figure out how to avoid pushing same data into database. For example, if I specify earliest=-5m and make execution schedule every second, same data will be pushed into database. I have tried to set earliest=-5m and make execution schedule every 5 minutes. But it still have a little bug. Assume next execution time is 12:00:00, the time field in the data is 11:59:59 and upload to Splunk takes 2 seconds, then the time that data being stored in Splunk is 12:00:01. At this time, this data may not be pushed to databased since Splunk automatically catch the time in the time field of data. Anyone know how to solve this?

 

Labels (1)
0 Karma

amoswuchi
Loves-to-Learn Lots

Thanks for your reply. But when I get the unique events every time, Splunk still pushes these unique events repeatedly to database. Do I misunderstand something?

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Possibly. Do you compare your events with what is already in the database before pushing the new ones to the database?

0 Karma

amoswuchi
Loves-to-Learn Lots

Yes. I have "ID" and "Time" fields which are the same in a table, and other fields are sensor data. I am not sure how to get unique event like this type of data.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

OK so if you use a dbquery to retrieve the rows by ID and time, you would be able to tell if the event had already been stored in the database. Therefore, you can eliminate them and only send the remaining new events to the database.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

If you can uniquely identify the events, you could filter what you are about to write to the database against what is already in the database.

For example, using a summary index instead of a database

index <source index>
...
| search NOT [search <target index>
              | fields <fields which uniquely identify events>]
| collect index=<target index>
0 Karma
Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...