<?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 can I do a subsearch in group by? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-do-a-subsearch-in-group-by/m-p/159521#M45030</link>
    <description>&lt;P&gt;This should do it:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=app sourcetype="***" | eval timePlus1 = _time + 1 | eval myTimes=if(route="CallIntake" AND action="New", _time . ":" . timePlus1,_time) | makemv delim=":" myTimes | stats values(*) AS * by UserName myTimes | where action="StartCall" AND route="CallIntake"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 03 Aug 2015 16:30:51 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2015-08-03T16:30:51Z</dc:date>
    <item>
      <title>How can I do a subsearch in group by?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-do-a-subsearch-in-group-by/m-p/159519#M45028</link>
      <description>&lt;P&gt;Hey folks,&lt;/P&gt;

&lt;P&gt;I am really new to Splunk and this has bothered me for several days. I have following data by a query:&lt;BR /&gt;
DateTime            UserName        ID                                      Route           Action&lt;BR /&gt;
07/30/2015 09:56:41 AMSEyerushalmi  15142095186                             CallIntake      New&lt;BR /&gt;
07/30/2015 09:33:59 AMSHjansen      30780945-d17b-4785-a1b1-11426cfedfa5    Agent           EndCall&lt;BR /&gt;
07/30/2015 09:33:59 AMSHjansen      15142087154                             Autodoc         Update_ICase&lt;BR /&gt;
07/30/2015 09:34:00 AMSHjansen      30780945-d17b-4785-a1b1-11426cfedfa5    Application     StartCall&lt;BR /&gt;
07/30/2015 09:35:58 AMSHjansen      30780945-d17b-4785-a1b1-11426cfedfa5    CallIntake      New&lt;BR /&gt;
07/30/2015 09:35:58 AMSHjansen      15142091213                             Application     StartCall&lt;BR /&gt;
07/30/2015 09:35:59 AMSHjansen      15142091213                             ProductSearch   SearchLodging&lt;BR /&gt;
07/30/2015 09:35:59 AMSHjansen      15142091213                             ProductSearch   SearchLodging&lt;BR /&gt;
07/30/2015 09:35:59 AMSHjansen      15142091213                             ProductSearch   SearchLodging&lt;/P&gt;

&lt;P&gt;and my search is:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=app sourcetype="***"
| convert ctime(_time) as DateTime
| table DateTime  UserName ID Route Action
| sort UserName by DateTime
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want to find all the Application/StartCall routes and in the same second or previous second there is a CallIntake/New with the same UserName.&lt;/P&gt;

&lt;P&gt;So for this one, it should return me &lt;STRONG&gt;07/30/2015 09:35:58  AMSHjansen      15142091213                             Application     StartCall&lt;/STRONG&gt;. Because in the same second, there's a CallIntake/New and also it is "AMSHjansen".&lt;/P&gt;

&lt;P&gt;Should I do this by a subsearch? This has bothered me for several days.&lt;/P&gt;

&lt;P&gt;Any help will be appreciated. &lt;/P&gt;</description>
      <pubDate>Mon, 03 Aug 2015 16:02:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-do-a-subsearch-in-group-by/m-p/159519#M45028</guid>
      <dc:creator>sureleo</dc:creator>
      <dc:date>2015-08-03T16:02:03Z</dc:date>
    </item>
    <item>
      <title>Re: How can I do a subsearch in group by?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-do-a-subsearch-in-group-by/m-p/159520#M45029</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=app sourcetype="***" Application StartCall [ search index=app sourcetype="***"  CallIntake New
                   | eval earliest=_time| eval latest=_time+2 
                   | fields UserName earliest latest 
                   | FORMAT "(" "(" "" ")" "OR" ")" ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;First, the subsearch finds all "Callintake New" actions. Then the outer search uses the timeranges and UserNames to choose the "Application StartCall" events.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Aug 2015 16:18:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-do-a-subsearch-in-group-by/m-p/159520#M45029</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2015-08-03T16:18:34Z</dc:date>
    </item>
    <item>
      <title>Re: How can I do a subsearch in group by?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-do-a-subsearch-in-group-by/m-p/159521#M45030</link>
      <description>&lt;P&gt;This should do it:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=app sourcetype="***" | eval timePlus1 = _time + 1 | eval myTimes=if(route="CallIntake" AND action="New", _time . ":" . timePlus1,_time) | makemv delim=":" myTimes | stats values(*) AS * by UserName myTimes | where action="StartCall" AND route="CallIntake"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 03 Aug 2015 16:30:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-do-a-subsearch-in-group-by/m-p/159521#M45030</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-08-03T16:30:51Z</dc:date>
    </item>
    <item>
      <title>Re: How can I do a subsearch in group by?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-do-a-subsearch-in-group-by/m-p/159522#M45031</link>
      <description>&lt;P&gt;I had a typo, try again.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Aug 2015 16:43:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-do-a-subsearch-in-group-by/m-p/159522#M45031</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-08-03T16:43:52Z</dc:date>
    </item>
  </channel>
</rss>

