<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to get max and average response time and their related fields in the same table? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-max-and-average-response-time-and-their-related/m-p/623192#M216646</link>
    <description>&lt;P&gt;Hi Sir,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Because the number of Test-id becomes quite large, after I apply the code as a solution,&lt;/P&gt;&lt;PRE&gt;| stats max(*) as max* avg(*) as avg* list(*) as *&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;The warning will be displayed along with the output:&lt;/P&gt;&lt;DIV class=""&gt;&lt;FONT color="#3366FF"&gt;The following caution(s) occurred while the search ran. &lt;/FONT&gt;&lt;/DIV&gt;&lt;UL&gt;&lt;LI&gt;&lt;FONT color="#3366FF"&gt;'stats' command: limit for values of field 'xxx' reached. Some values may have been truncated or ignored.&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Is there any way to avoid or solve this issue ?&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
    <pubDate>Mon, 05 Dec 2022 08:03:06 GMT</pubDate>
    <dc:creator>Jouman</dc:creator>
    <dc:date>2022-12-05T08:03:06Z</dc:date>
    <item>
      <title>How to get max and average response time and their related fields in the same table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-max-and-average-response-time-and-their-related/m-p/620543#M215722</link>
      <description>&lt;P&gt;Hi all,&lt;BR /&gt;&lt;BR /&gt;I am working on calculating the response time (for max, PR99, and avg value) from Table 1.&lt;BR /&gt;I would like to list the detail procedure duration (Procedure-1/-2/-3) and name the ROW1 as max/PR99/AVG, the output would be similar as Table 2.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Do anyone have idea about how to implement this to include max response time and the corresponding Procedure time as well, instead of list maximum value in each field?&amp;nbsp;&lt;BR /&gt;Moreover, is there any way to include average response time and average Procedure-1/-2/-3 time into the same table as well?&lt;BR /&gt;&lt;/STRONG&gt;&lt;BR /&gt;Table 1:&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="20%" height="47px"&gt;(in sec)&lt;/TD&gt;&lt;TD width="20%" height="47px"&gt;Procedure-1&lt;/TD&gt;&lt;TD width="20%" height="47px"&gt;Procedure-2&lt;/TD&gt;&lt;TD width="20%" height="47px"&gt;Procedure-3&lt;/TD&gt;&lt;TD width="20%" height="47px"&gt;Total Response Time&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="20%" height="25px"&gt;Test-1&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;111&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;222&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;333&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;666&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="25px"&gt;Test-2&lt;/TD&gt;&lt;TD height="25px"&gt;200&lt;/TD&gt;&lt;TD height="25px"&gt;100&lt;/TD&gt;&lt;TD height="25px"&gt;300&lt;/TD&gt;&lt;TD height="25px"&gt;600&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="25px"&gt;Test-3&lt;/TD&gt;&lt;TD height="25px"&gt;250&lt;/TD&gt;&lt;TD height="25px"&gt;350&lt;/TD&gt;&lt;TD height="25px"&gt;150&lt;/TD&gt;&lt;TD height="25px"&gt;750&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;Table 2:&lt;/P&gt;&lt;TABLE border="1" width="778px"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="46.25px" height="47px"&gt;(in sec)&lt;/TD&gt;&lt;TD width="182.688px" height="47px"&gt;Total Response Time&lt;/TD&gt;&lt;TD width="182.688px" height="47px"&gt;Procedure-1&lt;/TD&gt;&lt;TD width="182.688px" height="47px"&gt;Procedure-2&lt;/TD&gt;&lt;TD width="182.688px" height="47px"&gt;Procedure-3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="46.25px" height="25px"&gt;Max&lt;/TD&gt;&lt;TD width="182.688px" height="25px"&gt;750 (Test 3)&lt;/TD&gt;&lt;TD width="182.688px" height="25px"&gt;250 (come from Test 3)&lt;/TD&gt;&lt;TD width="182.688px" height="25px"&gt;350&amp;nbsp;(come from Test 3)&lt;/TD&gt;&lt;TD width="182.688px" height="25px"&gt;150&amp;nbsp;(come from Test 3)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="46.25px" height="25px"&gt;Avg&lt;/TD&gt;&lt;TD width="182.688px" height="25px"&gt;(666+600+750)/3=672&lt;/TD&gt;&lt;TD width="182.688px" height="25px"&gt;(111+200+250)/3=187&lt;/TD&gt;&lt;TD width="182.688px" height="25px"&gt;(222+100+350)/3=224&lt;/TD&gt;&lt;TD width="182.688px" height="25px"&gt;(333+300+150)/3=261&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much.&lt;BR /&gt;#table #chart #stats #max&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2022 01:50:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-max-and-average-response-time-and-their-related/m-p/620543#M215722</guid>
      <dc:creator>Jouman</dc:creator>
      <dc:date>2022-11-14T01:50:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to get max and average response time and their related fields in the same table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-max-and-average-response-time-and-their-related/m-p/620570#M215731</link>
      <description>&lt;P&gt;The SPL maxim: If the question is mathematically well defined, the answer is "yes".&lt;/P&gt;&lt;P&gt;Exhibit A:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats max(*) as max* avg(*) as avg* list(*) as *
| eval avg = "Avg", max = "Max"
| foreach Total* Procedure* ``` actual order depends on real name of Procedure_1, 2, 3, etc ```
    [eval avg = avg . ":" . 'avg&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;' . "=(" . mvjoin(&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;, "+") . ")/3",
    max = max . ":" . 'max&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;' . " (from Test-" . tostring(mvfind(&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;, 'max&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;') + 1) . ")"]
| eval maxavg = mvappend(max, avg)
| fields maxavg
| mvexpand maxavg
| eval maxavg = split(maxavg, ":")
| eval header = mvappend("(in sec)", "Total Response Time", "Procedure-1", "Procedure-2", "Procedure-3")
| foreach "(in sec)", "Total Response Time", "Procedure-1", "Procedure-2", "Procedure-3"
    [eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; = mvindex(maxavg, mvfind(header, "&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;")) ]
| fields - header maxavg&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;(in sec)&lt;/TD&gt;&lt;TD&gt;Procedure-1&lt;/TD&gt;&lt;TD&gt;Procedure-2&lt;/TD&gt;&lt;TD&gt;Procedure-3&lt;/TD&gt;&lt;TD&gt;Total Response Time&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Max&lt;/TD&gt;&lt;TD&gt;250 (from Test-3)&lt;/TD&gt;&lt;TD&gt;350 (from Test-3)&lt;/TD&gt;&lt;TD&gt;333 (from Test-1)&lt;/TD&gt;&lt;TD&gt;750 (from Test-3)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Avg&lt;/TD&gt;&lt;TD&gt;187=(111+200+250)/3&lt;/TD&gt;&lt;TD&gt;224=(222+100+350)/3&lt;/TD&gt;&lt;TD&gt;261=(333+300+150)/3&lt;/TD&gt;&lt;TD&gt;672=(666+600+750)/3&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Test data emulation:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval _raw = "test_id,Procedure-1,Procedure-2,Procedure-3,Total Response Time
Test-1,111,222,333,666
Test-2,200,100,300,600
Test-3,250,350,150,750"
| multikv forceheader=1
| fields - _time _raw linecount&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Q.E.D.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Nov 2022 11:34:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-max-and-average-response-time-and-their-related/m-p/620570#M215731</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-11-11T11:34:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to get max and average response time and their related fields in the same table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-max-and-average-response-time-and-their-related/m-p/620698#M215771</link>
      <description>&lt;P&gt;Hi Yuanliu and all,&lt;/P&gt;&lt;P&gt;Thank you for the help, it helps a lot.&lt;/P&gt;&lt;P&gt;I correct my example data in Table 2 for maximum Test Response Time description.&lt;BR /&gt;&lt;BR /&gt;The purpose for the analysis is to find the the row which leads to maximum Test Response Time field.&lt;BR /&gt;So the Procedure-3 in Table 2 shall be 150 (from Test-3) instead of 333 (from Test-1).&lt;BR /&gt;Is there any way to fulfill this ?&lt;BR /&gt;Only the "Test Response Time" field is used to compare,&amp;nbsp; after choosing the max "Test Response Time", the Procedure-1/-2/-3 field come from that corresponding row instead of comparing Procedure-1/-2/-3 itself.&lt;BR /&gt;&lt;BR /&gt;Thank you so much.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2022 02:08:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-max-and-average-response-time-and-their-related/m-p/620698#M215771</guid>
      <dc:creator>Jouman</dc:creator>
      <dc:date>2022-11-14T02:08:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to get max and average response time and their related fields in the same table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-max-and-average-response-time-and-their-related/m-p/620703#M215774</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi Yuanliu and all,&lt;BR /&gt;&lt;BR /&gt;Thank for Yuanliu's help.&lt;BR /&gt;I modify from his code ; therefore I am able to solve the issue, "Only the "Test Response Time" field is used to compare,&amp;nbsp; after choosing the max "Test Response Time", the Procedure-1/-2/-3 field come from that corresponding row instead of comparing Procedure-1/-2/-3 itself." , whichi I listed earlier by the code in green highlight.&lt;BR /&gt;&lt;BR /&gt;| stats max(*) as max* avg(*) as avg* list(*) as *&lt;BR /&gt;| eval avg = "Avg", max = "Max" ``` avg, max initial value ```&lt;BR /&gt;&lt;FONT color="#339966"&gt;| foreach Total*&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;[eval max=max.":".'max&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;'."(from Test-".tostring(mvfind(&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;,'max&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;')+1).")", max_index=tostring(mvfind(&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;,'max&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;'))]&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;| foreach Procedure*&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;[eval max=if(isnotnull(mvindex(&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;,max_index)), max.":".mvindex(&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;,max_index),max)]&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;| foreach Total* Procedure*``` actual order depends on real name of Procedure_1, 2, 3, etc ```&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;[eval avg = avg . ":" . 'avg&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;' . "=(" . mvjoin(&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;, "+") . ")/3"]&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;| eval maxavg = mvappend(max, avg)&lt;BR /&gt;| fields + maxavg&lt;BR /&gt;| mvexpand maxavg&lt;BR /&gt;| eval maxavg = split(maxavg, ":")&lt;BR /&gt;| eval header = mvappend("(in sec)", "Total Response Time", "Procedure-1", "Procedure-2", "Procedure-3")&lt;BR /&gt;| foreach "(in sec)", "Total Response Time", "Procedure-1", "Procedure-2", "Procedure-3"&lt;BR /&gt;[eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; = mvindex(maxavg, mvfind(header, "&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;")) ]&lt;BR /&gt;| fields - header maxavg&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;This really helps me a lot.&lt;BR /&gt;Thank you&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2022 04:43:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-max-and-average-response-time-and-their-related/m-p/620703#M215774</guid>
      <dc:creator>Jouman</dc:creator>
      <dc:date>2022-11-14T04:43:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to get max and average response time and their related fields in the same table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-max-and-average-response-time-and-their-related/m-p/623192#M216646</link>
      <description>&lt;P&gt;Hi Sir,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Because the number of Test-id becomes quite large, after I apply the code as a solution,&lt;/P&gt;&lt;PRE&gt;| stats max(*) as max* avg(*) as avg* list(*) as *&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;The warning will be displayed along with the output:&lt;/P&gt;&lt;DIV class=""&gt;&lt;FONT color="#3366FF"&gt;The following caution(s) occurred while the search ran. &lt;/FONT&gt;&lt;/DIV&gt;&lt;UL&gt;&lt;LI&gt;&lt;FONT color="#3366FF"&gt;'stats' command: limit for values of field 'xxx' reached. Some values may have been truncated or ignored.&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Is there any way to avoid or solve this issue ?&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Dec 2022 08:03:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-max-and-average-response-time-and-their-related/m-p/623192#M216646</guid>
      <dc:creator>Jouman</dc:creator>
      <dc:date>2022-12-05T08:03:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to get max and average response time and their related fields in the same table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-max-and-average-response-time-and-their-related/m-p/623209#M216650</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/248164"&gt;@Jouman&lt;/a&gt;It is important to pose a separate subject as a new question so other people may search up the solution easier.&lt;/P&gt;&lt;P&gt;There are several pointers about list() running over limit.&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;If you don't have to use list, use values().&lt;OL&gt;&lt;LI&gt;list(*) as * is particularly expensive if there are many fields. Eliminate as many fields before the stats as possible using &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Fields" target="_blank" rel="noopener"&gt;fields&lt;/A&gt;.&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;LI&gt;If order is important but not all values are needed, use some method that doesn't use list(). This is a much deeper consideration that cannot be explained in a couple sentences.&lt;/LI&gt;&lt;LI&gt;Lastly, you can make changes in &lt;A href="https://docs.splunk.com/Documentation/Splunk/limits/Admin/Limitsconf" target="_blank" rel="noopener"&gt;limits.conf&lt;/A&gt; to allow more results. (But this requires more memory to be used.)&lt;/LI&gt;&lt;/OL&gt;</description>
      <pubDate>Mon, 05 Dec 2022 10:13:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-max-and-average-response-time-and-their-related/m-p/623209#M216650</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-12-05T10:13:07Z</dc:date>
    </item>
  </channel>
</rss>

