Splunk Search

File Comparision

akankshayadav
Path Finder

I have a file which is being indexed(say today) and then again indexed after updating(say tomorrow). I have to compare the events of the two versions and display the event(s) which is present in the  new one but not in old or vice versa. Can any help?

Labels (1)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

How is the file indexed? How do the events differ from day to day? How many events per file when indexed? What else can you say about the indexing process?

0 Karma

akankshayadav
Path Finder

Files are indexed through inputs.cong . 

Files differs as.. example file1 indexed today has 1event  ZC_01;11;13;30 and when updated and indexed it has 2 events ZC_01;11;13;30
                    ZC_01;11;13;29

i have to display the result as...   ZC_01;11;13;29 this is the newly added data in the updated file1.

 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Do the events from the two different days have different timestamps? Do events from the first indexing also appear in the second indexing (just with different timestamps)?

0 Karma

akankshayadav
Path Finder

akankshayadav_0-1621578250200.png

akankshayadav_1-1621578348703.png

 

This image can help you understand the scenario. 

 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

How about something like this

search 1
| append [search 2]
| eventstats count by _raw
| where count=1
0 Karma

akankshayadav
Path Finder

Actually sir, i am a very beginner. Can you  elaborate the query in an clear way. The above one didn't work. What should i write in place of search 1 and 2?

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

You might not need two searches if both times the file is indexed they go into the same index

index="compindex"
| eventstats count by _raw
| where count=1

The problem with defining your question with non-specific or fabricated examples is that the answers are often just as vague and it takes longer to resolve, but this is the price we pay for anonymisation 😁

akankshayadav
Path Finder

i did this one and got the resutl. thank u sir. and one more help.. how to display it as a table with columns 

source  time(when file was indexed latest)  OnlyThe NewData 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
index="compindex"
| eventstats count by _raw
| where count=1
| table source _indextime _raw
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!

Accelerate Splunk App Development with AI

  Learn how to automate the repetitive parts of your build cycle.   Watch On-Demand   Replay the Accelerate ...

Splunk Agent Observability: Measuring AI Value with Splunk Tokenomics on AWS

The AI landscape is moving faster than ever, and our latest 2026 State of Observability report provides the ...

Enterprise Security Watch Party: What’s New in 8.8 - Recap

Splunk Community HQ hosted a Splunk Enterprise Security Watch Party: What’s New In ES 8.8 last Thursday. I had ...