Splunk Search

average of response time for the service call per day.

shaikbavaji
New Member

sourceType="source_log" | rex field=_raw .... ........

Expected output :

Service_call Avf for 03/04 avg for 03/05 ........

addBook 125 180
addpens 60 70

Tags (1)
0 Karma

nickhills
Ultra Champion

Try this:

    sourcetype="app_log" | rex field=_raw ".serviceCall=(?\w+)(?:[^=\n]=){3}(?P\d+)." 
   | eventstats count,avg(time_ms) AS Avg_time_ms by serviceCall 
   | eval Avg_timetaken_ms=round(Avg_time_ms,2) 
   | timechart avg(Avg_timetaken_ms) by serviceCall span=1d

The timechart command will actually format your data for charting (which may be what you want anyway) but you can switch to the statistics view to see the table of results

If my comment helps, please give it a thumbs up!
0 Karma

shaikbavaji
New Member

Hi Nik!!!
Thank you for the query but the results are not as expected.

I executed search and got results like below...

    _time          getBookInfo  getPenInfo addBookInfo   addPenInfo OTHER
2019-03-08 22:00:00             19.29         47.18  86.89999999999999  
2019-03-08 22:30:00 512       105.09    348.3         19.29  86.89999999999999

0 Karma

shaikbavaji
New Member

but I'm looking for the result as below

Service_call        Avg_for_03/04    Avg_for_03/05 ........ so on

addBook             125                      180
addpens               60                         70
0 Karma

nickhills
Ultra Champion

Are you able to give us the full search you are using, and an example of the results your search produces?
There is not enough information at present to help.
Please also use the code tool which looks like 101010 when posting search queries or results.

If my comment helps, please give it a thumbs up!
0 Karma

shaikbavaji
New Member

Hi Nickhill!

Greetings for the day!!!.

Search I'm using now :

sourcetype="app_log" | rex field=_raw ".serviceCall=(?\w+)(?:[^=\n]=){3}(?P\d+)." | stats count,avg(time_ms) AS Avg_time_ms by serviceCall | eval Avg_timetaken_ms=round(Avg_time_ms,2) | sort -Avg_time_ms

Current Output for last 15 mins :

serviceCall count Avg_timetaken_ms

getBookInfo 4 340.75
getPenInfo 4 232.00
addBookInfo 1 191.00
addPenInfo 3 70.67


Now I'm trying to get avgerage time per day

Expected out put :

serviceCall Avg_time_ms_03/08 Avg_time_ms_03/07 Avg_time_ms_03/06 ......so on

getBookInfo 340.75 320.00 310.00
getPenInfo 232.00 250.25 280.23
addBookInfo 191.00 180.25 195.45
addPenInfo 70.67 65.24 68.55

After this I want to compare these each serice avg rsponse time with two different time period..

like.... I want to compare getBookInfo avg_response of this month with previous month, and I want to show difference in next coloumn.

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!

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 ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...