Splunk Search

How to mark difference between Two CSV

shugup2923
Path Finder

Hi Guys,

There is a csv which gets updated every day once with details such as-
VMName Group CPU Memory Storage PowerState

I need to add column as "Any Changes" with value Yes or No.

So that if there is change in values for particular host it should show as yes in "Any Changes" column-
VMName Group CPU Memory Storage PowerState AnyChanges

Note:- This needs to be checked for month,, if there are any changes it should be highlighted in column "Any Changes"

Please let me know how this can be implemented,.

Tags (1)
0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @shugup2923,
I don't have your data, but see this approach using the distict_count option of stats command:

index=your_index
| stats 
     dc(CPU) AS dc_CPU 
     dc(Memory) AS dc_Memory 
     dc(Storage) AS dc_Storage 
     dc(PowerState) AS dc_PowerState 
     values(CPU) AS CPU 
     values(Memory) AS Memory 
     values(Storage) AS Storage 
     values(PowerState) AS PowerState 
     values(Group) AS Group 
     BY VMName 
| eval AnyChanges=if(dc_CPU>1 OR dc_Memory>1 OR dc_Storage>1 OR dc_PowerState>1,"Yes","No")
| table VMName Group CPU Memory Storage PowerState AnyChanges

Ciao.
Giuseppe

0 Karma

to4kawa
Ultra Champion
index=your_csv
|table columnA columnB columnC ....
|eventstats dc(*) as anychange_*
|eval anychange=0
|foreach anychange_* [ eval anychange=anychange+<<FIELD>>]
|eval "Any Changes"=case(anychange>0,"yes",anychange=0,"no") 
|fields - anychange*
0 Karma

to4kawa
Ultra Champion

Is your Csv indexed daily?

0 Karma

shugup2923
Path Finder

Yes every day once

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!

Where Innovation Takes Flight: The Splunk4Aviation Flight Sim Lands at .conf26

If you hear someone at .conf26 shouting "gear down, GEAR DOWN" across the show floor, you have found us.  The ...

Turn Cisco Telemetry Into Action with Cisco Data Fabric, powered by the Splunk ...

The surge in machine data is already hitting enterprise budgets, and the agentic era will only intensify it. ...

Persistent Queue at TcpOut — One of Splunk's Most Practical Features

Splunk introduced persistent queueing at the tcpout layer as one of the most practical resilience features in ...