Splunk Search

Disabling the effect of wildcard in a Query

shabdadev
Engager

Hi All ,

I have this query :

index=no host=los*  sourcetype= plp  (  path=/desktop /pl/* ) OR ( path=/mobile/pl/*   ) |  stats perc95(responseTime) as "95th Perc Response Time" by path

I Want the result to come like this as shown below( coagulated response time for the desktop and mobile separately ) :

Path                                                           95th Perc Response Time
/desktop/pl/*                                            234
/mobile/pl/*                                              2344

But the result is showing all the url's in path section just because i have used a wildcard in that place .

how to modify this query to get the expected the result. ??

Tags (1)
0 Karma
1 Solution

javiergn
SplunkTrust
SplunkTrust

Try this instead (NOT TESTED so there might be typos):

index=no host=los*  sourcetype= plp  (path="/desktop/pl/*" OR  path="/mobile/pl/*") 
| eval pathSummary = if(match(path, "/desktop/pl/*"), "/desktop/pl/*", "/mobile/pl/*")
|  stats perc95(responseTime) as "95th Perc Response Time" by pathSummary

The second line groups your paths based on your preferences and then assigns that into a new field that you can use in your stats.

Thanks,
J

View solution in original post

0 Karma

niketn
Legend

Since you have only two paths (or systems) i.e. desktop and mobile in your base search. Following should work:

 index="no" host="los*"  sourcetype="plp"  (  path="/desktop/pl/*" ) OR ( path="/mobile/pl/*"   ) 
| eval path=if(match(path,"desktop"),"desktop","mobile")
| stats perc95(responseTime) as "95th Perc Response Time" by path
____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

niketn
Legend

Oh too late. You already got your answer 🙂

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

shabdadev
Engager

hahahha Thanks you Niket too....i guess logic is same in both . Thanks again 🙂

0 Karma

javiergn
SplunkTrust
SplunkTrust

Try this instead (NOT TESTED so there might be typos):

index=no host=los*  sourcetype= plp  (path="/desktop/pl/*" OR  path="/mobile/pl/*") 
| eval pathSummary = if(match(path, "/desktop/pl/*"), "/desktop/pl/*", "/mobile/pl/*")
|  stats perc95(responseTime) as "95th Perc Response Time" by pathSummary

The second line groups your paths based on your preferences and then assigns that into a new field that you can use in your stats.

Thanks,
J

0 Karma

shabdadev
Engager

Thanks a lot 🙂 ..it worked

0 Karma

niketn
Legend

@shabdadev, in order to avoid your code from getting escaped, use the code button (101010) while posting your query. Please try to Edit your question and re-post with code button query and sample table.

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

shabdadev
Engager

HI Niket i have modified the post ..please see again

0 Karma
Get Updates on the Splunk Community!

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...