Splunk Search

Splunk search for failed count percentage out of total of each event

sahil237888
Path Finder

Hi, I need help in creating one query.
There is one field "Operator" having multiple values like airphone,bphone,vsphone etc.

The query should return the total count of each (airphone,bphone,vsphone etc.) per minute along with failed percentage of each.

Also if that query could specify for which location there are maximum failure of each.

Tags (1)
0 Karma
1 Solution

sahil237888
Path Finder

Working search:

source="logfilename" host="test" index="splunkdata"  earliest=-10m
| eventstats count(eval(Logon_message="for")) as Successful by Operator
| eventstats  count(eval(Logon_message="error")) as Failed by Operator 
| eventstats  count(eval(Logon_message="*")) as Total by Operator 
| eval perc_error = ((Failed)/(Total)*100) 
| stats values(Successful) as "Total Successful"  values(Failed) as "Total Failed" values(Total) as "Total Logins" values(perc_error) as Percentage by Operator

View solution in original post

0 Karma

sahil237888
Path Finder

Working search:

source="logfilename" host="test" index="splunkdata"  earliest=-10m
| eventstats count(eval(Logon_message="for")) as Successful by Operator
| eventstats  count(eval(Logon_message="error")) as Failed by Operator 
| eventstats  count(eval(Logon_message="*")) as Total by Operator 
| eval perc_error = ((Failed)/(Total)*100) 
| stats values(Successful) as "Total Successful"  values(Failed) as "Total Failed" values(Total) as "Total Logins" values(perc_error) as Percentage by Operator
0 Karma

adonio
Ultra Champion

hello there,
with plenty of respect, it seems like you are almost asking us to do your homework for you.
how would you tell if its failed or succeeded?
what have you tried so far? share your search please as well as a sample data.

0 Karma

sahil237888
Path Finder

Thanks adonio.
I was missing in a point to use eventstats for the same.
I have achieved the desired results.

0 Karma

somesoni2
Revered Legend

Glad you're able to find a resolution on your own. Please post the search/solution that has worked for you as an answer and accept the same to close this question. This will help other splunkers with similar issues to know the working solution.

0 Karma
Get Updates on the Splunk Community!

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!

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

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...