<?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 join 2 query from different sources? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-2-query-from-different-sources/m-p/294622#M88912</link>
    <description>&lt;P&gt;Hi auaave,&lt;/P&gt;

&lt;P&gt;after indexing your csv I was able to get it working with this SPL:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Your base search here to get all events
| eval LOCATION=case(like(REQLOCATIONTEXT,"%ASRS%"),"ASRS", like(REQLOCATIONTEXT,"%Induct%") or like(REQLOCATIONTEXT,"%Receiving%"),"Conveyors", LOCATION="1", "Sorter", isnotnull(LOCATION), LOCATION, 1=1, "unknonw") 
| stats count(eval(source="mfc_read.csv" OR (BIT_FLAGS="1" OR BIT_FLAGS="4" OR BIT_FLAGS="9"))) AS READ, count(eval(source="mfc_noread.csv" OR (BIT_FLAGS="2"))) AS NOREAD by LOCATION 
| eval "READ%"=round(READ/(READ+NOREAD)*100,2)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The &lt;EM&gt;problem&lt;/EM&gt; was that we lost &lt;CODE&gt;LOCATION=1&lt;/CODE&gt; after the first &lt;CODE&gt;stats&lt;/CODE&gt;, so I extended the first &lt;CODE&gt;eval&lt;/CODE&gt; and it worked &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Hope this helps and all suitcases are tracked correctly now &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
    <pubDate>Sun, 18 Feb 2018 19:57:10 GMT</pubDate>
    <dc:creator>MuS</dc:creator>
    <dc:date>2018-02-18T19:57:10Z</dc:date>
    <item>
      <title>How to join 2 query from different sources?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-2-query-from-different-sources/m-p/294614#M88904</link>
      <description>&lt;P&gt;Hi Guys,&lt;/P&gt;

&lt;P&gt;I have 2 queries that I have to combine. I haven't done this before and I'm really struggling. &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;BR /&gt;
1st query:  coming from 2 sources with the same value of Locations&lt;BR /&gt;
2nd query: from 3rd source with different data set&lt;BR /&gt;
I used |append to combine the results of my 2 queries but it's not working.&lt;/P&gt;

&lt;P&gt;Based on my below query, I would like to have this result:&lt;BR /&gt;
Location-------READ---NOREAD--READ%&lt;BR /&gt;
ASRS------------100-------0------------100%&lt;BR /&gt;
Conveyors------100-------0------------100%&lt;BR /&gt;
Sorter------------100-------0------------100%&lt;/P&gt;

&lt;P&gt;Thank you!&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="main" source="FC_READ" OR source="FC_NOREAD"
| eval LOCATION=case(like(LOCATIONTEXT,"%RS%"),"RS", like(LOCATIONTEXT,"%Induct%") or like(LOCATIONTEXT,"%Receiving%"),"Conveyors") 
| chart count(eval(source="FC_READ")) AS READ, count(eval(source="FC_NOREAD")) AS NOREAD by LOCATION 
| eval "READ%"=round(READ/(READ+NOREAD)*100,2) 
| append 
    [|makeresults |search source="DEST_MSG" LOCATION=0001 
    | stats count(eval(BIT=0001 OR BIT=0004 OR BIT=0009)) AS READ count(eval(BIT=0002 )) AS "NOREAD" by LOCATION 
    | eval "READ%"=round(((READ*100)/(READ+NOREAD)),2) 
    | replace "0001" with SORTER]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 14 Feb 2018 23:44:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-2-query-from-different-sources/m-p/294614#M88904</guid>
      <dc:creator>auaave</dc:creator>
      <dc:date>2018-02-14T23:44:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to join 2 query from different sources?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-2-query-from-different-sources/m-p/294615#M88905</link>
      <description>&lt;P&gt;why is there a &lt;CODE&gt;makeresults&lt;/CODE&gt; in the second query&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| append 
     [**|makeresults** |search source="DEST_MSG" LOCATION=0001 
     | stats count(eval(BIT=0001 OR BIT=0004 OR BIT=0009)) AS READ count(eval(BIT=0002 )) AS "NOREAD" by LOCATION 
     | eval "READ%"=round(((READ*100)/(READ+NOREAD)),2) 
     | replace "0001" with SORTER]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Feb 2018 00:20:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-2-query-from-different-sources/m-p/294615#M88905</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2018-02-15T00:20:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to join 2 query from different sources?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-2-query-from-different-sources/m-p/294616#M88906</link>
      <description>&lt;P&gt;@MuS, I was just trying to see if adding make results would show the results of the second query.  Anyway, with or without  "makeresults" the result of my second query doesn't show. &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2018 00:28:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-2-query-from-different-sources/m-p/294616#M88906</guid>
      <dc:creator>auaave</dc:creator>
      <dc:date>2018-02-15T00:28:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to join 2 query from different sources?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-2-query-from-different-sources/m-p/294617#M88907</link>
      <description>&lt;P&gt;&lt;CODE&gt;Makeresults&lt;/CODE&gt; simply creates an event for you, nothing more.&lt;/P&gt;

&lt;P&gt;Okay baby steps first:&lt;BR /&gt;
Does the second search &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search source="DEST_MSG" LOCATION=0001 
  | stats count(eval(BIT=0001 OR BIT=0004 OR BIT=0009)) AS READ count(eval(BIT=0002 )) AS "NOREAD" by LOCATION 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;return anything?&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2018 00:48:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-2-query-from-different-sources/m-p/294617#M88907</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2018-02-15T00:48:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to join 2 query from different sources?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-2-query-from-different-sources/m-p/294618#M88908</link>
      <description>&lt;P&gt;@MuS, ok, thanks for the info. Yes, the second query returns the data of the sorter.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2018 01:18:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-2-query-from-different-sources/m-p/294618#M88908</guid>
      <dc:creator>auaave</dc:creator>
      <dc:date>2018-02-15T01:18:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to join 2 query from different sources?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-2-query-from-different-sources/m-p/294619#M88909</link>
      <description>&lt;P&gt;okay give this a try:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="main" ( source="FC_READ" OR source="FC_NOREAD" ) ( source="DEST_MSG" LOCATION=0001 ) 
| eval LOCATION=case(like(LOCATIONTEXT,"%RS%"),"RS", like(LOCATIONTEXT,"%Induct%") or like(LOCATIONTEXT,"%Receiving%"),"Conveyors") 
| stats count(eval(source="FC_READ" OR (BIT=0001 OR BIT=0004 OR BIT=0009))) AS READ, count(eval(source="FC_NOREAD" OR BIT=0002)) AS NOREAD by LOCATION 
| eval "READ%"=round(READ/(READ+NOREAD)*100,2), LOCATION=if(LOCATION="0001", "SORTER", LOCATION)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Feb 2018 01:44:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-2-query-from-different-sources/m-p/294619#M88909</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2018-02-15T01:44:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to join 2 query from different sources?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-2-query-from-different-sources/m-p/294620#M88910</link>
      <description>&lt;P&gt;@MuS, I tried it but it still doesn't return the result of the sorter. &lt;BR /&gt;
I added "OR" between the 2 groups of sources.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2018 02:13:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-2-query-from-different-sources/m-p/294620#M88910</guid>
      <dc:creator>auaave</dc:creator>
      <dc:date>2018-02-15T02:13:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to join 2 query from different sources?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-2-query-from-different-sources/m-p/294621#M88911</link>
      <description>&lt;P&gt;@auaave, let's take that offline - I will contact you.&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2018 19:07:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-2-query-from-different-sources/m-p/294621#M88911</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2018-02-15T19:07:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to join 2 query from different sources?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-2-query-from-different-sources/m-p/294622#M88912</link>
      <description>&lt;P&gt;Hi auaave,&lt;/P&gt;

&lt;P&gt;after indexing your csv I was able to get it working with this SPL:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Your base search here to get all events
| eval LOCATION=case(like(REQLOCATIONTEXT,"%ASRS%"),"ASRS", like(REQLOCATIONTEXT,"%Induct%") or like(REQLOCATIONTEXT,"%Receiving%"),"Conveyors", LOCATION="1", "Sorter", isnotnull(LOCATION), LOCATION, 1=1, "unknonw") 
| stats count(eval(source="mfc_read.csv" OR (BIT_FLAGS="1" OR BIT_FLAGS="4" OR BIT_FLAGS="9"))) AS READ, count(eval(source="mfc_noread.csv" OR (BIT_FLAGS="2"))) AS NOREAD by LOCATION 
| eval "READ%"=round(READ/(READ+NOREAD)*100,2)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The &lt;EM&gt;problem&lt;/EM&gt; was that we lost &lt;CODE&gt;LOCATION=1&lt;/CODE&gt; after the first &lt;CODE&gt;stats&lt;/CODE&gt;, so I extended the first &lt;CODE&gt;eval&lt;/CODE&gt; and it worked &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Hope this helps and all suitcases are tracked correctly now &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Sun, 18 Feb 2018 19:57:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-2-query-from-different-sources/m-p/294622#M88912</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2018-02-18T19:57:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to join 2 query from different sources?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-2-query-from-different-sources/m-p/294623#M88913</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/2012"&gt;@MuS&lt;/a&gt;, thanks a lot for your reply. The query was able to add the row for the sorter, the only problem is, it's not counting the "READ" and "NOREAD" events, instead it counted all the events under "READ" field. I can't insert the below codes to the query to count the "READ" and "NOREAD" events.&lt;/P&gt;

&lt;P&gt;| stats count(eval(BIT_FLAGS=0001 OR BIT_FLAGS=0004 OR BIT_FLAGS=0009)) AS READ count(eval(BIT_FLAGS=0002 )) AS "NOREAD" by LOCATION &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 18:08:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-2-query-from-different-sources/m-p/294623#M88913</guid>
      <dc:creator>auaave</dc:creator>
      <dc:date>2020-09-29T18:08:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to join 2 query from different sources?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-2-query-from-different-sources/m-p/294624#M88914</link>
      <description>&lt;P&gt;Updated to get the READ/NOREAD counts for Sorter &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Feb 2018 18:05:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-2-query-from-different-sources/m-p/294624#M88914</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2018-02-19T18:05:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to join 2 query from different sources?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-2-query-from-different-sources/m-p/294625#M88915</link>
      <description>&lt;P&gt;This works perfectly! Thanks a lot @MuS &lt;/P&gt;</description>
      <pubDate>Tue, 20 Feb 2018 01:15:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-2-query-from-different-sources/m-p/294625#M88915</guid>
      <dc:creator>auaave</dc:creator>
      <dc:date>2018-02-20T01:15:21Z</dc:date>
    </item>
  </channel>
</rss>

