Splunk Search

How to get the events where the value is greater than 40 using where condition?

jip31
Motivator

hello

I use this code

index="perfmon" sourcetype="perfmon:logicaldisk" instance=c:  | eval Value=round(Value, 2)."%" | where Value > "40.00%"  | dedup host | table host Value

but the WHEN condition dont works because when I do I have also datas
what I have to do for having 1 if Value > 40% and 0 if Value <40% when i count the events?
thanks

0 Karma
1 Solution

kmaron
Motivator
index="perfmon" sourcetype="perfmon:logicaldisk" instance=c: Value>40 
| dedup host 
| eval Value=round(Value, 2)."%" 
| table host Value

If you only want the events where the Value is greater than 40 you can add that to your initial search and it will drop any other events.

View solution in original post

0 Karma

ddrillic
Ultra Champion

"(?<percent>.*)%" will extract the numerical value...

You can test it with -

index=<any index>
| eval _raw="40.00%"
| rex field=_raw "(?<percent>.*)%"
0 Karma

jip31
Motivator

thanks!
regards

0 Karma

ddrillic
Ultra Champion

And this might be useful -

index=<any index>
| eval _raw="40.00%"
| rex field=_raw "(?<percent>.*)%"
| eval percent2  = case(percent >= 40, 1, percent < 40, 0)
0 Karma

kmaron
Motivator
index="perfmon" sourcetype="perfmon:logicaldisk" instance=c: Value>40 
| dedup host 
| eval Value=round(Value, 2)."%" 
| table host Value

If you only want the events where the Value is greater than 40 you can add that to your initial search and it will drop any other events.

0 Karma

jip31
Motivator

perfect thanks!

0 Karma
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...