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 Value Insights (Beta): Understand the Business Impact your organization ...

Real progress on your strategic priorities starts with knowing the business outcomes your teams are delivering ...

Enterprise Security (ES) Essentials 8.3 is Now GA — Smarter Detections, Faster ...

As of today, Enterprise Security (ES) Essentials 8.3 is now generally available, helping SOC teams simplify ...

Unlock Instant Security Insights from Amazon S3 with Splunk Cloud — Try Federated ...

Availability: Must be on Splunk Cloud Platform version 10.1.2507.x to view the free trial banner. If you are ...