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!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...