Splunk Search

Multiple Stats from Base Search

cdstealer
Contributor

Hi,  I'm trying to populate a dashboard using a base search and then pulling multiple stats from those results.

base search: 

 

index=production sourcetype="audit" environ::LV

 

inline search: 

 

| appendpipe 
    [ stats count AS Total by _time] 
| appendpipe 
    [ search ("Error:" OR auditType="error") 
    | stats count AS error by _time] 
| appendpipe 
    [ where auditMicroSeconds>3 
    | stats count AS Over BY _time] 
| appendpipe 
    [ search ("data retrieval" AND "failed") 
    | stats count AS failed BY _time] 
| timechart span=30s count(Total) AS Total count(error) AS Error count(Over) AS Over

 

 But it just doesn't work.  Hope this makes sense.

TIA

Steve

Labels (4)
0 Karma
1 Solution

cdstealer
Contributor

Solving my own question 🙂

Base search is now:

index=production sourcetype="audit" environ::LV | table *

and panel searches are:

| search (field=value OR field=value OR field=value) field=value 
| appendpipe 
    [stats count AS total by _time] 
| appendpipe 
    [search auditType="error" 
    | stats count AS error by _time] 
| appendpipe 
    [where auditMicroSeconds>3 
    | stats count AS over BY _time] 
| appendpipe 
    [search ("data retrieval" AND "failed") 
    | stats count AS failed BY _time] 
| timechart span=30s count(error) AS Error count(over) AS Over3s count(failed) AS Failed count(total) AS Total

 Data is now being presented as expected 🙂

View solution in original post

0 Karma

cdstealer
Contributor

Solving my own question 🙂

Base search is now:

index=production sourcetype="audit" environ::LV | table *

and panel searches are:

| search (field=value OR field=value OR field=value) field=value 
| appendpipe 
    [stats count AS total by _time] 
| appendpipe 
    [search auditType="error" 
    | stats count AS error by _time] 
| appendpipe 
    [where auditMicroSeconds>3 
    | stats count AS over BY _time] 
| appendpipe 
    [search ("data retrieval" AND "failed") 
    | stats count AS failed BY _time] 
| timechart span=30s count(error) AS Error count(over) AS Over3s count(failed) AS Failed count(total) AS Total

 Data is now being presented as expected 🙂

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Would something like this get you what you want?

index=production sourcetype="audit" environ::LV
| eval error=if(searchmatch ("Error:" OR auditType="error"),1,null())
| eval Over=if(auditMicroSeconds>3,1,null()) 
| eval failed=if(searchmatch ("data retrieval" AND "failed"),1,null())
| timechart span=30s count AS Total count(error) AS Error count(Over) AS Over
0 Karma

cdstealer
Contributor

Hey, Thanks for the suggestion 🙂  Unfortunately it doesn't work 😞  I had to remove the OR X and AND X from the searchmatch and then it just returned the same results as the original.  Appreciated though.

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...