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
Get Updates on the Splunk Community!

What the End of Support for Splunk Add-on Builder Means for You

Hello Splunk Community! We want to share an important update regarding the future of the Splunk Add-on Builder ...

Solve, Learn, Repeat: New Puzzle Channel Now Live

Welcome to the Splunk Puzzle PlaygroundIf you are anything like me, you love to solve problems, and what ...

Building Reliable Asset and Identity Frameworks in Splunk ES

 Accurate asset and identity resolution is the backbone of security operations. Without it, alerts are ...