All Apps and Add-ons

Splunk Find Duplicates Within KV Store And Compare Source

joemarty82
Explorer

Hello,

 

I am having problems trying to find duplicate entries within my splunk kvstore. Basically, what I want to do is find duplicates based on a few fields such as FQDN, CVE, and PORT. Then, once I found duplicates I just want to output them in a table if their SOURCE field is different. The query I have so far is:

| inputlookup vul_kvstore
| stats count by fqdn, port, cve
| where count>1
| table fqdn, port, cve, source

The problem I have now is in my table I do not have access to the source field as it looks like the stats count line basically pulls out only the fqdn, port, and cve data. How do I get access to the source field data? Maybe I just have to revise my original query so I do not loose data to that field but so far nothing I try works. Hopefully someone can provide me some advise to push me through this problem.

 

Thanks,

Joe

Labels (2)

Nisha18789
Builder

Hi @joemarty82 , can you try this

 

| inputlookup vul_kvstore
| stats count by source fqdn, port, cve
| where count>1
| table source, fqdn, port, cve
0 Karma

thambisetty
SplunkTrust
SplunkTrust

| inputlookup vul_kvstore

| stats dc(source) as distinct_source_count values(source) as source by fqdn, port, cve

| where distinct_source_count > 1

| table fqdn, port, cve, source

————————————
If this helps, give a like below.
0 Karma

joemarty82
Explorer

Hey Tham,

 

Thanks for the input. However, this will not work because the source field only contains one entry in each kvstore record. Looks like your solution assumes there are more than 1.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

How much can you really learn in 3 minutes?

Observability can certainly be hard to understand – there's a lot of jargon and buzzwords and it seems to ...

Event Series: The Agentic SOC: Trust Before Autonomy

AI is fundamentally changing security operations, but true progress requires more than just automation—it ...

Free Professional Services for .conf26 Attendees

This year at .conf26, we are doing something a little different. We are bringing the best minds from ...