<?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 value of a field corresponding to max value of another field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-value-of-a-field-corresponding-to-max-value-of/m-p/439620#M125062</link>
    <description>&lt;P&gt;Solution to my query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; search_string|streamstats max(LoadTime) as max_time by Application|sort +Application -LoadTime|streamstats first(max_time) as max_time by Application|where LoadTime=max_time|table Application,max_time,User
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you need to use stats function like sum as well on any of the field, you can do as follows:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; search_string|eventstats sum(LoadTime) as TotalTime by Application| streamstats max(LoadTime) as max_time by Application|sort +Application -LoadTime|streamstats first(max_time) as max_time by Application|where LoadTime=max_time|table Application,max_time,User,TotalTime
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 14 Jun 2018 02:24:17 GMT</pubDate>
    <dc:creator>ggangwar</dc:creator>
    <dc:date>2018-06-14T02:24:17Z</dc:date>
    <item>
      <title>How to get value of a field corresponding to max value of another field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-value-of-a-field-corresponding-to-max-value-of/m-p/439613#M125055</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
I have a table with the fields 'loadtime', 'application', and 'user'.&lt;BR /&gt;
First I want to compute the maximum value of loadtime for all application. Then I want to create a table/chart which has application field's value in rows, corresponding maximum loadtime value in column. I also want to have user field's value for the maximum loadtime calculated for each application. &lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/5134i0012D3EF57A3B429/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;BR /&gt;
Is there any way to accomplish this using Splunk?&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jun 2018 03:50:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-value-of-a-field-corresponding-to-max-value-of/m-p/439613#M125055</guid>
      <dc:creator>ggangwar</dc:creator>
      <dc:date>2018-06-07T03:50:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to get value of a field corresponding to max value of another field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-value-of-a-field-corresponding-to-max-value-of/m-p/439614#M125056</link>
      <description>&lt;P&gt;Is this OK?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(your search)|stats max(loadtime) as loadtime by application,user
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Jun 2018 05:07:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-value-of-a-field-corresponding-to-max-value-of/m-p/439614#M125056</guid>
      <dc:creator>HiroshiSatoh</dc:creator>
      <dc:date>2018-06-07T05:07:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to get value of a field corresponding to max value of another field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-value-of-a-field-corresponding-to-max-value-of/m-p/439615#M125057</link>
      <description>&lt;P&gt;No, it displays results by both columns i.e. for every user wise I will get the result using suggested query. &lt;/P&gt;</description>
      <pubDate>Thu, 07 Jun 2018 07:11:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-value-of-a-field-corresponding-to-max-value-of/m-p/439615#M125057</guid>
      <dc:creator>ggangwar</dc:creator>
      <dc:date>2018-06-07T07:11:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to get value of a field corresponding to max value of another field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-value-of-a-field-corresponding-to-max-value-of/m-p/439616#M125058</link>
      <description>&lt;P&gt;Can anyone please help in above query?&lt;/P&gt;</description>
      <pubDate>Sat, 09 Jun 2018 17:31:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-value-of-a-field-corresponding-to-max-value-of/m-p/439616#M125058</guid>
      <dc:creator>ggangwar</dc:creator>
      <dc:date>2018-06-09T17:31:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to get value of a field corresponding to max value of another field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-value-of-a-field-corresponding-to-max-value-of/m-p/439617#M125059</link>
      <description>&lt;P&gt;@ggangwar your requirement and table snapshot is confusing. As per your question you need &lt;CODE&gt;...maximum value of loadtime for all application&lt;/CODE&gt; which should have only one value for Application1 i.e. 120.&lt;/P&gt;

&lt;P&gt;As per your screenshot seems like you have two max loadTimes per application per user i.e. 120 for user abc and 100 from user xyz for Application1. So, as per your table @HiroshiSatoh seems to be correct. So, if it is not we would need further raw events i.e. data sample with Application/s and Users/s with various loadtime and the final output that you need.&lt;/P&gt;</description>
      <pubDate>Sun, 10 Jun 2018 16:24:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-value-of-a-field-corresponding-to-max-value-of/m-p/439617#M125059</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-06-10T16:24:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to get value of a field corresponding to max value of another field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-value-of-a-field-corresponding-to-max-value-of/m-p/439618#M125060</link>
      <description>&lt;P&gt;Apologies for confusion and typo error from me. Its Application2 in second row:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;                 LoadTime   User
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Application1       120           abc&lt;BR /&gt;
Application2       100            xyz&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jun 2018 15:44:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-value-of-a-field-corresponding-to-max-value-of/m-p/439618#M125060</guid>
      <dc:creator>ggangwar</dc:creator>
      <dc:date>2018-06-11T15:44:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to get value of a field corresponding to max value of another field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-value-of-a-field-corresponding-to-max-value-of/m-p/439619#M125061</link>
      <description>&lt;P&gt;I have got the solution. Using streamstats I can achieve these stats.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search_string|streamstats max(LoadTime) as max_time by Application|sort +Application -LoadTime|streamstats first(max_time) as max_time by Application|where LoadTime=max_time|table Application,max_time,User
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Jun 2018 03:02:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-value-of-a-field-corresponding-to-max-value-of/m-p/439619#M125061</guid>
      <dc:creator>ggangwar</dc:creator>
      <dc:date>2018-06-12T03:02:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to get value of a field corresponding to max value of another field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-value-of-a-field-corresponding-to-max-value-of/m-p/439620#M125062</link>
      <description>&lt;P&gt;Solution to my query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; search_string|streamstats max(LoadTime) as max_time by Application|sort +Application -LoadTime|streamstats first(max_time) as max_time by Application|where LoadTime=max_time|table Application,max_time,User
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you need to use stats function like sum as well on any of the field, you can do as follows:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; search_string|eventstats sum(LoadTime) as TotalTime by Application| streamstats max(LoadTime) as max_time by Application|sort +Application -LoadTime|streamstats first(max_time) as max_time by Application|where LoadTime=max_time|table Application,max_time,User,TotalTime
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 14 Jun 2018 02:24:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-value-of-a-field-corresponding-to-max-value-of/m-p/439620#M125062</guid>
      <dc:creator>ggangwar</dc:creator>
      <dc:date>2018-06-14T02:24:17Z</dc:date>
    </item>
  </channel>
</rss>

