Splunk Search

display results only above certain number

robK123
Explorer

I have this search I want to only display results for when the sum(failures) is higher than 4 how can I do this?

(index=infrastructure-os OR index=main) sudo "incorrect password attempt*" 
|rex field=_raw "sudo:[^a-z]+(?<user>[^ ]+) : (?<failures>[0-9]+) incorrect"
|stats sum(failures) by user, host 
| where user!="addm"| 
Tags (1)
0 Karma
1 Solution

lguinn2
Legend

Try this!

(index=infrastructure-os OR index=main) sudo "incorrect password attempt*" 
| rex field=_raw "sudo:[^a-z]+(?<user>[^ ]+) : (?<failures>[0-9]+) incorrect"
| stats sum(failures) as totalFailures by user, host 
| where user!="addm" AND totalFailures > 4

Notice that you can give a name to the results of the stats calculation. Once it has a field name (totalFailures), you can use it in further commands...

View solution in original post

lguinn2
Legend

Try this!

(index=infrastructure-os OR index=main) sudo "incorrect password attempt*" 
| rex field=_raw "sudo:[^a-z]+(?<user>[^ ]+) : (?<failures>[0-9]+) incorrect"
| stats sum(failures) as totalFailures by user, host 
| where user!="addm" AND totalFailures > 4

Notice that you can give a name to the results of the stats calculation. Once it has a field name (totalFailures), you can use it in further commands...

robK123
Explorer

That worked! 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 ...