<?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: Why is the query with 3 sub search returning several items? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-is-the-query-with-3-sub-search-returning-several-items/m-p/414559#M119425</link>
    <description>&lt;P&gt;All three of the searches should have the same &lt;CODE&gt;earliest&lt;/CODE&gt; and &lt;CODE&gt;latest&lt;/CODE&gt; settings.&lt;/P&gt;

&lt;P&gt;If you problem is resolved, please accept the answer to help future readers.&lt;/P&gt;</description>
    <pubDate>Sat, 30 Jun 2018 18:58:21 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2018-06-30T18:58:21Z</dc:date>
    <item>
      <title>Why is the query with 3 sub search returning several items?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-the-query-with-3-sub-search-returning-several-items/m-p/414554#M119420</link>
      <description>&lt;P&gt;Hello there ! &lt;/P&gt;

&lt;P&gt;This is my first post here  &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
I've already read a lot of query/answer, try a lot of things, but .... i'm still not getting something good &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;I'd need to mix 3 differents queries in order to get my final result. &lt;BR /&gt;
I would like to be able to run only ONE query instead of doing step by step the 3 of them. &lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;A. the first query : get the all transactionId&lt;/STRONG&gt;&lt;BR /&gt;
Extract all fields called "transactionId" for one source where the word 'ERROR' is seen&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;* "] ERROR" source=*exp* | table transactionId | dedup transactionId
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For example, this will return 2 lines : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;dd2ff560-7bcd-11e8-8ac7-005056ac4954  
db846840-7bcd-11e8-8ac7-005056ac4954
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;B. based on the transactionId found in query A, found the correlationId&lt;/STRONG&gt; : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;* source=*mb05* HTTPHeaderHandler.InboundHeaders ( transactionId from query A ) | rename message_id as correlationId | table correlationId
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My query in a step by step mode looks like &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;* source=*mb05* HTTPHeaderHandler.InboundHeaders (dd2ff560-7bcd-11e8-8ac7-005056ac4954  OR db846840-7bcd-11e8-8ac7-005056ac4954) | rename message_id as correlationId | table correlationId
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The result is 2 lines also : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;zz31ca20-7bcd-11e8-8ac7-005056ac4954  
zz863d00-7bcd-11e8-8ac7-005056ac4954  
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;_&lt;EM&gt;C. with the correlationId found on B get all the lines with Exception _&lt;/EM&gt; :  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;* source=*mb05* ExceptionHandler.HandledException  ( correlationID from query B)  | fields _raw
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In my step by step mode : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;* source=*mb05* ExceptionHandler.HandledException  (  zz31ca20-7bcd-11e8-8ac7-005056ac4954 OR zz863d00-7bcd-11e8-8ac7-005056ac4954 )  | fields _raw
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That gives me the log that I'm looking for. &lt;BR /&gt;
A bit annoying to do it step by step. &lt;/P&gt;

&lt;P&gt;So I'd like to get something like : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;* source=*mb05* ExceptionHandler.HandledException  [ search source=*mb05* HTTPHeaderHandler.InboundHeaders [ search * "] ERROR" source=*exp* | table transactionId | dedup transactionId ] | rename message_id as correlationId | table correlationId ] | fields _raw
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If anybody has some clue to help me I will be more than happy ! &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Thanks in advance for your help!&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jun 2018 20:04:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-the-query-with-3-sub-search-returning-several-items/m-p/414554#M119420</guid>
      <dc:creator>tomtomFR</dc:creator>
      <dc:date>2018-06-29T20:04:40Z</dc:date>
    </item>
    <item>
      <title>Re: Why is the query with 3 sub search returning several items?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-the-query-with-3-sub-search-returning-several-items/m-p/414555#M119421</link>
      <description>&lt;P&gt;Your final query is close to what I suggest.  What do you get when you run it?  BTW, &lt;CODE&gt;fields&lt;/CODE&gt; is more efficient than &lt;CODE&gt;table&lt;/CODE&gt; as an interim command.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source=*mb05* ExceptionHandler.HandledException  [ search source=*mb05* HTTPHeaderHandler.InboundHeaders [ search * "] ERROR" source=*exp* | stats list(transactionId) as transactionId | mvexpand | format ] | rename message_id as correlationId | fields correlationId | format ] | fields _raw
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 29 Jun 2018 20:52:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-the-query-with-3-sub-search-returning-several-items/m-p/414555#M119421</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2018-06-29T20:52:37Z</dc:date>
    </item>
    <item>
      <title>Re: Why is the query with 3 sub search returning several items?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-the-query-with-3-sub-search-returning-several-items/m-p/414556#M119422</link>
      <description>&lt;P&gt;thanks for your answer @Rich&lt;/P&gt;

&lt;P&gt;I try to run your command, and just made a small change with mvexpand as it first failed :&lt;BR /&gt;
(with error : "Error in 'mvexpand' command: A field name is expected." )  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source=*mb05* ExceptionHandler.HandledException  [ search source=*mb05* HTTPHeaderHandler.InboundHeaders [ search * "] ERROR" source=*exp* | stats list(transactionId) as transactionId | mvexpand transactionId | format ] | rename message_id as correlationId | fields correlationId | format ] | fields _raw    
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The result is "no data found"&lt;/P&gt;

&lt;P&gt;I try to make it step by step&lt;BR /&gt;
1. the first part to get all transactionId =&amp;gt; found the right ID&lt;BR /&gt;
2. then to get the correlationId =&amp;gt; no more data&lt;/P&gt;

&lt;P&gt;I ran : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;* source=*mb05* HTTPHeaderHandler.InboundHeaders [ search * "] ERROR" source=*exp* | stats list(transactionId) as transactionId | mvexpand transactionId | format ] | rename message_id as correlationId | fields correlationId | format 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and I get the following table/result : &lt;/P&gt;

&lt;H2&gt;correlationId    |     search&lt;/H2&gt;

&lt;P&gt;&amp;lt;&amp;gt;      |  NOT()&lt;/P&gt;

&lt;P&gt;for the 1st part&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[ search * "] ERROR" source=*exp* | stats list(transactionId) as transactionId | mvexpand transactionId | format ] 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;it's creating something like : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;( ( transactionId="dd2ff560-7bcd-11e8-8ac7-005056ac4954" ) OR ( transactionId="db846840-7bcd-11e8-8ac7-005056ac4954" ) )
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;this is why it failed ! &lt;BR /&gt;
is it possible to get only something like : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;( ( "dd2ff560-7bcd-11e8-8ac7-005056ac4954" ) OR ( "db846840-7bcd-11e8-8ac7-005056ac4954" ) )
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;?&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jun 2018 21:15:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-the-query-with-3-sub-search-returning-several-items/m-p/414556#M119422</guid>
      <dc:creator>tomtomFR</dc:creator>
      <dc:date>2018-06-29T21:15:58Z</dc:date>
    </item>
    <item>
      <title>Re: Why is the query with 3 sub search returning several items?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-the-query-with-3-sub-search-returning-several-items/m-p/414557#M119423</link>
      <description>&lt;P&gt;@Richgalloway you're my heroe !! (l)&lt;/P&gt;

&lt;P&gt;using this link : &lt;A href="https://answers.splunk.com/answers/1212/can-a-subsearch-return-only-the-value-without-the-fieldname.html"&gt;https://answers.splunk.com/answers/1212/can-a-subsearch-return-only-the-value-without-the-fieldname.html&lt;/A&gt; &lt;/P&gt;

&lt;P&gt;I found how to reply to my last question. &lt;/P&gt;

&lt;P&gt;So I try something new with your reply, and now that's working perfectly !!! &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source=*mb05* ExceptionHandler.HandledException  [ search source=*mb05* HTTPHeaderHandler.InboundHeaders [ search * "] ERROR" source=*exp* | stats list(transactionId) as search | mvexpand search | format ] | stats list(message_id) as search | format ] | fields _raw
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks a lot !!!!!&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jun 2018 21:25:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-the-query-with-3-sub-search-returning-several-items/m-p/414557#M119423</guid>
      <dc:creator>tomtomFR</dc:creator>
      <dc:date>2018-06-29T21:25:08Z</dc:date>
    </item>
    <item>
      <title>Re: Why is the query with 3 sub search returning several items?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-the-query-with-3-sub-search-returning-several-items/m-p/414558#M119424</link>
      <description>&lt;P&gt;one more question still &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;/P&gt;

&lt;P&gt;where should I put the earliest and latest command to make the query(ies) more efficient ? &lt;BR /&gt;
on the 3 of them ? only on the one to get the transactionId ? ...? &lt;/P&gt;</description>
      <pubDate>Fri, 29 Jun 2018 21:29:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-the-query-with-3-sub-search-returning-several-items/m-p/414558#M119424</guid>
      <dc:creator>tomtomFR</dc:creator>
      <dc:date>2018-06-29T21:29:11Z</dc:date>
    </item>
    <item>
      <title>Re: Why is the query with 3 sub search returning several items?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-the-query-with-3-sub-search-returning-several-items/m-p/414559#M119425</link>
      <description>&lt;P&gt;All three of the searches should have the same &lt;CODE&gt;earliest&lt;/CODE&gt; and &lt;CODE&gt;latest&lt;/CODE&gt; settings.&lt;/P&gt;

&lt;P&gt;If you problem is resolved, please accept the answer to help future readers.&lt;/P&gt;</description>
      <pubDate>Sat, 30 Jun 2018 18:58:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-the-query-with-3-sub-search-returning-several-items/m-p/414559#M119425</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2018-06-30T18:58:21Z</dc:date>
    </item>
    <item>
      <title>Re: Why is the query with 3 sub search returning several items?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-the-query-with-3-sub-search-returning-several-items/m-p/414560#M119426</link>
      <description>&lt;P&gt;thanks to @richgalloway&lt;BR /&gt;
and a quick look at this link &lt;A href="https://answers.splunk.com/answers/1212/can-a-subsearch-return-only-the-value-without-the-fieldname.html"&gt;https://answers.splunk.com/answers/1212/can-a-subsearch-return-only-the-value-without-the-fieldname.html&lt;/A&gt; &lt;/P&gt;

&lt;P&gt;the final answer is : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source=*mb05* ExceptionHandler.HandledException  [ search source=*mb05* HTTPHeaderHandler.InboundHeaders [ search * "] ERROR" source=*exp* | stats list(transactionId) as search | mvexpand search | format ] | stats list(message_id) as search | format ] | fields _raw
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 30 Jun 2018 20:10:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-the-query-with-3-sub-search-returning-several-items/m-p/414560#M119426</guid>
      <dc:creator>tomtomFR</dc:creator>
      <dc:date>2018-06-30T20:10:00Z</dc:date>
    </item>
    <item>
      <title>Re: Why is the query with 3 sub search returning several items?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-the-query-with-3-sub-search-returning-several-items/m-p/414561#M119427</link>
      <description>&lt;P&gt;@tomtomFR If your problem is resolved, please accept an answer to help future readers.&lt;/P&gt;</description>
      <pubDate>Sun, 01 Jul 2018 12:26:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-the-query-with-3-sub-search-returning-several-items/m-p/414561#M119427</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2018-07-01T12:26:12Z</dc:date>
    </item>
  </channel>
</rss>

