Splunk Search

How to only display columns where the duration is > 1 second?

djoobbani
Path Finder

Dear Splunk Community :

 

I have the following search query:

<Basic_search> duration | stats count, avg(duration), perc99(duration), by path_template

Attached please find a sample of the screen result for the above search.

 

Labels (1)
0 Karma
1 Solution

bowesmana
SplunkTrust
SplunkTrust

Maybe you're looking for

| eval "avg(duration)"=if('avg(duration)'<1,null(),'avg(duration)')
| eval "perc99(duration)"=if('perc99(duration)'<1,null(),'perc99(duration)')

which will clear any values that are less than zero in the two duration columns.

Note you would be better off renaming your columns in the stats, as it makes it easier to manipulate the fields afterwards, e.g.

| stats count, avg(duration) as AvgDuration, perc99(duration) asP99Duration, by path_template

 

View solution in original post

bowesmana
SplunkTrust
SplunkTrust

Maybe you're looking for

| eval "avg(duration)"=if('avg(duration)'<1,null(),'avg(duration)')
| eval "perc99(duration)"=if('perc99(duration)'<1,null(),'perc99(duration)')

which will clear any values that are less than zero in the two duration columns.

Note you would be better off renaming your columns in the stats, as it makes it easier to manipulate the fields afterwards, e.g.

| stats count, avg(duration) as AvgDuration, perc99(duration) asP99Duration, by path_template

 

djoobbani
Path Finder

Great, that works! Thanks for the info. appreciate it!

0 Karma

djoobbani
Path Finder

Sorry forgot to ask the question.

I need to modify this search :

source=r42-core-api msg="served request" duration | stats count, avg(duration)  by path_template

to only display the columns/numbers where avg(duration) > 1 second.

How do i do that?

Thanks!

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

duration isn't one of your columns

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...