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
Get Updates on the Splunk Community!

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...