<?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 do you combine two different searches with two different sources? in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/How-do-you-combine-two-different-searches-with-two-different/m-p/397267#M6769</link>
    <description>&lt;P&gt;@skoelpin can you relax? The solution I'm using at the moment is the one I created. The first solution you posted does not work. The second solution let me know how to use the eval function which I am using. Why are you so agitated? I did not respond because like you I'm in work and didn't have time to respond within 24 hours... fucking hell &lt;/P&gt;</description>
    <pubDate>Wed, 21 Nov 2018 15:14:04 GMT</pubDate>
    <dc:creator>edwardryan</dc:creator>
    <dc:date>2018-11-21T15:14:04Z</dc:date>
    <item>
      <title>How do you combine two different searches with two different sources?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-do-you-combine-two-different-searches-with-two-different/m-p/397255#M6757</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I am attempting to use Splunk to search two log files that hold activity for two platforms of an application "IOS" &amp;amp; "Android".&lt;BR /&gt;
The log file for each platform unfortunately uses a different identifier for login behavior. &lt;/P&gt;

&lt;P&gt;I would like to combine both searches into one.&lt;/P&gt;

&lt;P&gt;Currently each of my searches look like the following (some filters are the same)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;gt; index=I1 source=S1 sourcetype=ST1 host=H1 "searchCriteria1"earliest=-1hr latest=now | timechart span=5m count by host
&amp;gt; index=I2 source=S2 sourcetype=ST1 host=H1 "searchCriteria2" earliest=-1hr latest=now | timechart span=5m count by host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I would like to have the result displayed as follows; total, android and ios.&lt;/P&gt;

&lt;P&gt;I am using the JAVA API to splunk, so as long as I can differentiate Android from IOS on the response, that is ok.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Time | Total Logins | Android Logins | IOS Logins
01:00 | 10 | 8 | 2
02:00 | 15 | 10 | 5
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have looked into "multiSearch" and "subsearches" but I am new to using Splunk and do not know exactly what I am trying to do.&lt;/P&gt;

&lt;P&gt;Any help is greatly appreciated!&lt;/P&gt;

&lt;P&gt;Thank you,&lt;BR /&gt;
Anon&lt;/P&gt;

&lt;P&gt;EDIT: Considering I can differentiate between each platform via "source", the following query does produce a correct result, although I'm unsure if its the correct way. Is there a better way to obtain the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index=jboss source=/var/log/jboss/server.log sourcetype=jboss:server:log host="lblux31*" "NewState showDashboard PreviousState checkIfActiveCustomer") 
OR
(index=jboss-mobile source=/var/log/jboss-mobile/server.log sourcetype=jboss:server:log host="lblux31*" "[EVENT]login") earliest=-1hr latest=now
| bucket _time span=5m 
| stats count by _time, source, host 
| sort - Time
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 20 Nov 2018 13:39:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-do-you-combine-two-different-searches-with-two-different/m-p/397255#M6757</guid>
      <dc:creator>edwardryan</dc:creator>
      <dc:date>2018-11-20T13:39:01Z</dc:date>
    </item>
    <item>
      <title>Re: How do you combine two different searches with two different sources?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-do-you-combine-two-different-searches-with-two-different/m-p/397256#M6758</link>
      <description>&lt;P&gt;Try this &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index=I1 source=S1 sourcetype=ST1 host=H1) OR (index=I2 source=S2 sourcetype=ST1 host=H1)
  ("searchCriteria1") OR ( "searchCriteria2")  earliest=-1hr latest=now
| timechart span=5m count by host
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 20 Nov 2018 15:36:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-do-you-combine-two-different-searches-with-two-different/m-p/397256#M6758</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2018-11-20T15:36:17Z</dc:date>
    </item>
    <item>
      <title>Re: How do you combine two different searches with two different sources?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-do-you-combine-two-different-searches-with-two-different/m-p/397257#M6759</link>
      <description>&lt;P&gt;Try like this (check eval command to ensure the mapping of source is correct)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=jboss source=/var/log/jboss/server.log sourcetype=jboss:server:log host="lblux31*" "NewState showDashboard PreviousState checkIfActiveCustomer") 
 OR
 (index=jboss-mobile source=/var/log/jboss-mobile/server.log sourcetype=jboss:server:log host="lblux31*" "[EVENT]login") earliest=-1hr latest=now
| eval type=if(source="/var/log/jboss/server.log","Android","IOS")
 | timechart span=5m count by type
| eval "Total Logins"=Android + IOS
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 20 Nov 2018 16:24:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-do-you-combine-two-different-searches-with-two-different/m-p/397257#M6759</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2018-11-20T16:24:33Z</dc:date>
    </item>
    <item>
      <title>Re: How do you combine two different searches with two different sources?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-do-you-combine-two-different-searches-with-two-different/m-p/397258#M6760</link>
      <description>&lt;P&gt;Looks like you've solved your problem.  The only change I'd make is &lt;CODE&gt;| bucket span=1h _time&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;Put your edit into an answer and accept it.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Nov 2018 01:20:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-do-you-combine-two-different-searches-with-two-different/m-p/397258#M6760</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2018-11-21T01:20:03Z</dc:date>
    </item>
    <item>
      <title>Re: How do you combine two different searches with two different sources?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-do-you-combine-two-different-searches-with-two-different/m-p/397259#M6761</link>
      <description>&lt;P&gt;Sometimes I ask myself why do I even contribute when most users don't even bother to accept the answer after using the solution provided &lt;/P&gt;</description>
      <pubDate>Wed, 21 Nov 2018 14:41:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-do-you-combine-two-different-searches-with-two-different/m-p/397259#M6761</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2018-11-21T14:41:51Z</dc:date>
    </item>
    <item>
      <title>Re: How do you combine two different searches with two different sources?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-do-you-combine-two-different-searches-with-two-different/m-p/397260#M6762</link>
      <description>&lt;P&gt;@skoelpin No one has posted a solution that I have used yet&lt;/P&gt;</description>
      <pubDate>Wed, 21 Nov 2018 15:03:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-do-you-combine-two-different-searches-with-two-different/m-p/397260#M6762</guid>
      <dc:creator>edwardryan</dc:creator>
      <dc:date>2018-11-21T15:03:54Z</dc:date>
    </item>
    <item>
      <title>Re: How do you combine two different searches with two different sources?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-do-you-combine-two-different-searches-with-two-different/m-p/397261#M6763</link>
      <description>&lt;P&gt;Unfortunately I can't use timechart because I need to groupBy multiple fields. "stats count by" looks to be what I require. &lt;/P&gt;</description>
      <pubDate>Wed, 21 Nov 2018 15:05:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-do-you-combine-two-different-searches-with-two-different/m-p/397261#M6763</guid>
      <dc:creator>edwardryan</dc:creator>
      <dc:date>2018-11-21T15:05:53Z</dc:date>
    </item>
    <item>
      <title>Re: How do you combine two different searches with two different sources?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-do-you-combine-two-different-searches-with-two-different/m-p/397262#M6764</link>
      <description>&lt;P&gt;@richgalloway I need the data structured at small intervals, that is why I was using span=5m over an hour period. Mainly because I would like to chart the output&lt;/P&gt;</description>
      <pubDate>Wed, 21 Nov 2018 15:07:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-do-you-combine-two-different-searches-with-two-different/m-p/397262#M6764</guid>
      <dc:creator>edwardryan</dc:creator>
      <dc:date>2018-11-21T15:07:53Z</dc:date>
    </item>
    <item>
      <title>Re: How do you combine two different searches with two different sources?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-do-you-combine-two-different-searches-with-two-different/m-p/397263#M6765</link>
      <description>&lt;P&gt;You're question was how to combine 2 different searches with different sources. You have 2 solutions which you used and said it works.. You have not responded back or clarified what doesn't work.. What didn't get answered??&lt;/P&gt;</description>
      <pubDate>Wed, 21 Nov 2018 15:08:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-do-you-combine-two-different-searches-with-two-different/m-p/397263#M6765</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2018-11-21T15:08:47Z</dc:date>
    </item>
    <item>
      <title>Re: How do you combine two different searches with two different sources?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-do-you-combine-two-different-searches-with-two-different/m-p/397264#M6766</link>
      <description>&lt;P&gt;Thanks, the eval command looks useful - I was doing this mapping afterwards using Java, but your solution looks a lot better.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Nov 2018 15:09:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-do-you-combine-two-different-searches-with-two-different/m-p/397264#M6766</guid>
      <dc:creator>edwardryan</dc:creator>
      <dc:date>2018-11-21T15:09:36Z</dc:date>
    </item>
    <item>
      <title>Re: How do you combine two different searches with two different sources?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-do-you-combine-two-different-searches-with-two-different/m-p/397265#M6767</link>
      <description>&lt;P&gt;Then use &lt;CODE&gt;stats&lt;/CODE&gt;... What's the issue?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index=I1 source=S1 sourcetype=ST1 host=H1) OR (index=I2 source=S2 sourcetype=ST1 host=H1)
   ("searchCriteria1") OR ( "searchCriteria2")  earliest=-1hr latest=now
| bin _time span=5m
| stats  count by host, &amp;lt;OTHER FIELD&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 21 Nov 2018 15:09:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-do-you-combine-two-different-searches-with-two-different/m-p/397265#M6767</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2018-11-21T15:09:51Z</dc:date>
    </item>
    <item>
      <title>Re: How do you combine two different searches with two different sources?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-do-you-combine-two-different-searches-with-two-different/m-p/397266#M6768</link>
      <description>&lt;P&gt;There is no issue, I am using stats. I left a comment to say why I disagreed with your solution, would you rather I didnt comment at all?&lt;/P&gt;

&lt;P&gt;I am using stats, as seen by initial edit in the question - BEFORE you commented this answer&lt;/P&gt;</description>
      <pubDate>Wed, 21 Nov 2018 15:12:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-do-you-combine-two-different-searches-with-two-different/m-p/397266#M6768</guid>
      <dc:creator>edwardryan</dc:creator>
      <dc:date>2018-11-21T15:12:14Z</dc:date>
    </item>
    <item>
      <title>Re: How do you combine two different searches with two different sources?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-do-you-combine-two-different-searches-with-two-different/m-p/397267#M6769</link>
      <description>&lt;P&gt;@skoelpin can you relax? The solution I'm using at the moment is the one I created. The first solution you posted does not work. The second solution let me know how to use the eval function which I am using. Why are you so agitated? I did not respond because like you I'm in work and didn't have time to respond within 24 hours... fucking hell &lt;/P&gt;</description>
      <pubDate>Wed, 21 Nov 2018 15:14:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-do-you-combine-two-different-searches-with-two-different/m-p/397267#M6769</guid>
      <dc:creator>edwardryan</dc:creator>
      <dc:date>2018-11-21T15:14:04Z</dc:date>
    </item>
    <item>
      <title>Re: How do you combine two different searches with two different sources?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-do-you-combine-two-different-searches-with-two-different/m-p/397268#M6770</link>
      <description>&lt;P&gt;So what part of your original question did we not answer?&lt;/P&gt;</description>
      <pubDate>Wed, 21 Nov 2018 15:16:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-do-you-combine-two-different-searches-with-two-different/m-p/397268#M6770</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2018-11-21T15:16:17Z</dc:date>
    </item>
    <item>
      <title>Re: How do you combine two different searches with two different sources?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-do-you-combine-two-different-searches-with-two-different/m-p/397269#M6771</link>
      <description>&lt;P&gt;The solution in your update is A-OK.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Nov 2018 16:07:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-do-you-combine-two-different-searches-with-two-different/m-p/397269#M6771</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-11-21T16:07:45Z</dc:date>
    </item>
    <item>
      <title>Re: How do you combine two different searches with two different sources?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-do-you-combine-two-different-searches-with-two-different/m-p/397270#M6772</link>
      <description>&lt;P&gt;I found the following worked for me.&lt;BR /&gt;
Keypoints being the use of "OR" to separate the queries and "bucket" to divide the data&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; (index=jboss source=/var/log/jboss/server.log sourcetype=jboss:server:log host="lblux31*" "NewState showDashboard PreviousState checkIfActiveCustomer") 
 OR
 (index=jboss-mobile source=/var/log/jboss-mobile/server.log sourcetype=jboss:server:log host="lblux31*" "[EVENT]login") earliest=-1hr latest=now
 | bucket _time span=5m 
 | stats count by _time, source, host 
 | sort - Time
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 22 Nov 2018 10:46:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-do-you-combine-two-different-searches-with-two-different/m-p/397270#M6772</guid>
      <dc:creator>edwardryan</dc:creator>
      <dc:date>2018-11-22T10:46:20Z</dc:date>
    </item>
    <item>
      <title>Re: How do you combine two different searches with two different sources?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-do-you-combine-two-different-searches-with-two-different/m-p/397271#M6773</link>
      <description>&lt;P&gt;Yes this was shown to you as a solution.. Not sure why you're taking credit for solutions others provided, but might as well close it out.... &lt;/P&gt;</description>
      <pubDate>Mon, 26 Nov 2018 14:39:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-do-you-combine-two-different-searches-with-two-different/m-p/397271#M6773</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2018-11-26T14:39:15Z</dc:date>
    </item>
  </channel>
</rss>

