Splunk Search

Help with events data!

ppatrikfr
Path Finder

I have this code bellow and i want to just keep with lines of when my Virtual Machine changed Cluster ou VMhost.

Obs.: I cant use "dedup" because i have VMs that was moved to the same cluster twice.![alt text][1]

earliest=03/01/2018:00:00:00 latest=03/31/2018:23:59:00 sourcetype="VCENTER_VMS_INFO"
| eval VM=upper(VM)
| table _time VM VMhost Cluster
| where VM="VMName" | bucket span=1h _time | stats values(VMhost) as VMhost values(Cluster) as Cluster by _time VM |

Tags (1)
0 Karma
1 Solution

somesoni2
Revered Legend

Give this a try

earliest=03/01/2018:00:00:00 latest=03/31/2018:23:59:00 sourcetype="VCENTER_VMS_INFO" 
| eval VM=upper(VM) 
| table _time VM VMhost Cluster 
| where VM="DCDEV00027" | bucket span=1h _time | stats values(VMhost) as VMhost values(Cluster) as Cluster by _time VM 
| streamstats current=f window=1 values(VMhost) as prevVMhost values(Cluster) as prevCluster by VM 
| whehre VMhost!=prevVMhost OR Cluster!=prevCluster

View solution in original post

pradeepkumarg
Influencer

You can use autoregress to get the value from previous row and compare it with current row value. Something like below

| autoregress VMhost as Old_VMhost  | eval Flag=if(VMhost==Old_VMhost ,"N","Y") | where Flag="Y"
0 Karma

somesoni2
Revered Legend

Give this a try

earliest=03/01/2018:00:00:00 latest=03/31/2018:23:59:00 sourcetype="VCENTER_VMS_INFO" 
| eval VM=upper(VM) 
| table _time VM VMhost Cluster 
| where VM="DCDEV00027" | bucket span=1h _time | stats values(VMhost) as VMhost values(Cluster) as Cluster by _time VM 
| streamstats current=f window=1 values(VMhost) as prevVMhost values(Cluster) as prevCluster by VM 
| whehre VMhost!=prevVMhost OR Cluster!=prevCluster

ppatrikfr
Path Finder

It works as i was hoping, thanks for your help!!!

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!

Index This | What travels the world but is also stuck in place?

April 2026 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Discover New Use Cases: Unlock Greater Value from Your Existing Splunk Data

Realizing the full potential of your Splunk investment requires more than just understanding current usage; it ...

Continue Your Journey: Join Session 2 of the Data Management and Federation Bootcamp ...

As data volumes continue to grow and environments become more distributed, managing and optimizing data ...