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!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...