Splunk Search

File Comparision

akankshayadav
Path Finder

How can we compare different versions of a file?

Labels (2)
0 Karma

akankshayadav
Path Finder

I have a file, say abc.csv, which I indexed once having events a b c , then i indexed it again after some days updating it, having events a b c d, again i indexed it at some point of time, having events a c and again then i uploaded it having events a b c.


My desired output  
date 2- d

date 3- c

date 4- same

0 Karma

aasabatini
Motivator

Hi @akankshayadav 

can you add more details?

this file is already indexed? where are stored the file? maybe it's better a versioning software?

Regards

Alessandro

“The answer is out there, Neo, and it’s looking for you, and it will find you if you want it to.”
0 Karma

akankshayadav
Path Finder

I have a file, say abc.csv, which I indexed once having events a b c , then i indexed it again after some days updating it, having events a b c d, again i indexed it at some point of time, having events a c and again then i uploaded it having events a b c.


My desired output  
date 2- d

date 3- c

date 4- same

0 Karma

aasabatini
Motivator

Try this search to check when is indexed an event

 

index=<your index>
| eventstats count by _raw
| where count=1
| table source _indextime _raw

 

“The answer is out there, Neo, and it’s looking for you, and it will find you if you want it to.”
0 Karma

akankshayadav
Path Finder

This solution only compares the last and latest ones.. can u give something which compares the latest to all the previous ones. 
Regards 

0 Karma

aasabatini
Motivator

Hi @akankshayadav 

this search compares the previous event data to the last event data based on your timerange

| 
stats min(_indextime) as min_indextime max(_indextime) as max_indextime | convert ctime(min_indextime) ctime(max_indextime)
“The answer is out there, Neo, and it’s looking for you, and it will find you if you want it to.”
0 Karma

akankshayadav
Path Finder

sir can u please elaborate the code , how to frame it properly

0 Karma

aasabatini
Motivator

Hi @akankshayadav 

please describe how you would like the  output search.

“The answer is out there, Neo, and it’s looking for you, and it will find you if you want it to.”
0 Karma

aasabatini
Motivator
index= <your index>
| stats values(_indextime) as indextime by _raw | convert ctime(indextime)
“The answer is out there, Neo, and it’s looking for you, and it will find you if you want it to.”
0 Karma

akankshayadav
Path Finder

This solution gives  _raw  present in all the versions. Not the event which is different.

akankshayadav_0-1621938511104.png

 

0 Karma

aasabatini
Motivator

ok now you can expand your indextime field

index= <your index>
| stats values(_indextime) as indextime by _raw | convert ctime(indextime)
| mvexpand idextime 
| table idextime _raw
“The answer is out there, Neo, and it’s looking for you, and it will find you if you want it to.”
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!

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...

SplunkTrust Application Period is Officially OPEN!

It's that time, folks! The application/nomination period for the 2026-2027 SplunkTrust is officially open. If ...