- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

splunker9999
Path Finder
01-21-2016
09:22 AM
Hi,
We are looking for timeout percentage from the total events.
For Ex:
1. Query1: index=datapower Time=*|stats count
2. Query2: index=datapower Time>10000|stats count
Now we are looking for results as Query1/Query2. Do we need to do this with subsearch? Can anyone help with this?
Thanks
1 Solution
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

somesoni2
Revered Legend
01-21-2016
09:41 AM
Try something like this
index=datapower Time=* | stats count as Query1 count(eval(Time>10000)) as Query2 | eval Result=Query1/Query2
OR
index=datapower Time=* | eval Query2=if(Time>10000,1,0) | stats count as Query1 csum(Query2) as Query2 | eval Result=Query1/Query2
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

jrodman

Splunk Employee
01-21-2016
09:48 AM
The strict answer to your question is yes, you need two searches for the general case, whether subsearches, or other methods like reusing the output of one search as input in another.
However the usual answer is to craft a search that doesn't need to handle the general case, and thus this is a comment since +somesoni2 has addressed the inquiry.
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

somesoni2
Revered Legend
01-21-2016
09:41 AM
Try something like this
index=datapower Time=* | stats count as Query1 count(eval(Time>10000)) as Query2 | eval Result=Query1/Query2
OR
index=datapower Time=* | eval Query2=if(Time>10000,1,0) | stats count as Query1 csum(Query2) as Query2 | eval Result=Query1/Query2
