Getting Data In

How to only see duplicates?

JoshuaJohn
Contributor

I have two profile settings. They both shouldn't be on at the same time. I am trying to see which devices have both of these profiles, to generate a list.

index=nitro_apps
| rex "^[^,\n]*,(?P<OG>[^,]+)[^,\n]*,(?P<MacAddress>[^,]+)(?:[^ \n]* ){4}(?P<Model>[^,]+),(?P<OS>[^,]+),\w+,(?P<Profile>[^,]+),\d+,(?P<Latest_Version>\d+),(?P<Installed_Date>[^,]+)[^,\n]*,(?P<Installed>\w+)" 
| search location=* 
| eval Old_Status=if('Profile'="11.0.0.0",if(Installed="Yes","true","FAIL"),"") 
| eval New_Status=if('Profile'="12.0.0.0",if(Installed="Yes","true","FAIL"),"") 
| eval LD_Status=if('Old_Status'="true", if(New_Status="true","PASS","FAIL"),"")
| where 'LD_Status'=="PASS"
| stats list(MacAddress) as duplicates, dc(MacAddress) as DupCount by location

Any idea why I am not able to see the devices with both profile settings applied?

0 Karma
1 Solution

somesoni2
Revered Legend

Try this

index=nitro_apps location=* 
 | rex "^[^,\n]*,(?P<OG>[^,]+)[^,\n]*,(?P<MacAddress>[^,]+)(?:[^ \n]* ){4}(?P<Model>[^,]+),(?P<OS>[^,]+),\w+,(?P<Profile>[^,]+),\d+,(?P<Latest_Version>\d+),(?P<Installed_Date>[^,]+)[^,\n]*,(?P<Installed>\w+)" 
| where ('Profile'="11.0.0.0" OR 'Profile'="12.0.0.0") AND Installed="Yes"
| stats values(Profile) as Profiles by MacAddress location
| where mvcount(Profiles)=2 
| stats list(MacAddress) as duplicates, dc(MacAddress) as DupCount by location

View solution in original post

0 Karma

somesoni2
Revered Legend

Try this

index=nitro_apps location=* 
 | rex "^[^,\n]*,(?P<OG>[^,]+)[^,\n]*,(?P<MacAddress>[^,]+)(?:[^ \n]* ){4}(?P<Model>[^,]+),(?P<OS>[^,]+),\w+,(?P<Profile>[^,]+),\d+,(?P<Latest_Version>\d+),(?P<Installed_Date>[^,]+)[^,\n]*,(?P<Installed>\w+)" 
| where ('Profile'="11.0.0.0" OR 'Profile'="12.0.0.0") AND Installed="Yes"
| stats values(Profile) as Profiles by MacAddress location
| where mvcount(Profiles)=2 
| stats list(MacAddress) as duplicates, dc(MacAddress) as DupCount by location
0 Karma

JoshuaJohn
Contributor

This worked thank you.
Just curious what does this line do?
| where mvcount(Profiles)=2

0 Karma

harishalipaka
Motivator

Hi @JoshuaJohn

Change where condition like this and try once.

| where 'LD_Status'="PASS"
Thanks
Harish
0 Karma

JoshuaJohn
Contributor

Hi, unfortunately not.

0 Karma

Vijeta
Influencer

Hi,
An event can have one Profile value in an event or can there be 2 profile fields in one single event?
If an event has Profile field once in an event then Old Status and New status cannot be true at the same time for an event and then LD_Status cannot be pass.
In the same event are there 2 Profile values , how are you parsing both the profile values from the event?

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Thanks for the Memories! Splunk University, .conf25, and our Community

Thank you to everyone in the Splunk Community who joined us for .conf25, which kicked off with our iconic ...

Data Persistence in the OpenTelemetry Collector

This blog post is part of an ongoing series on OpenTelemetry. What happens if the OpenTelemetry collector ...

Introducing Splunk 10.0: Smarter, Faster, and More Powerful Than Ever

Now On Demand Whether you're managing complex deployments or looking to future-proof your data ...