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!

Shape the Future of Splunk: Join the Product Research Lab!

Join the Splunk Product Research Lab and connect with us in the Slack channel #product-research-lab to get ...

Auto-Injector for Everything Else: Making OpenTelemetry Truly Universal

You might have seen Splunk’s recent announcement about donating the OpenTelemetry Injector to the ...

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...