<?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 make two searches in the same index but different event types? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-make-two-searches-in-the-same-index-but-different-event/m-p/611350#M212556</link>
    <description>&lt;P&gt;Hi Giuseppe,&lt;/P&gt;&lt;P&gt;I like the way of doing that without join. i´ve notice that joins are terrible slow.&lt;/P&gt;&lt;P&gt;The problem with the example is that it give data that I don´t need. I mean eventtype 000111 is an event which occurs very few times in a week, meanwhile event 123 occurs permanently. both events, 000111 and 123 have the srcip field, but just the event 123 have the hostname field, so I need to having found an unique 000111 event, look for a 123 event which has the same ip address on the same time (around 10 minutes) to take its hostname.&amp;nbsp;&lt;/P&gt;&lt;P&gt;On the query suggested I´m getting ip and hostname for every event which has an 123 event. but they don´t have an 000111 event.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Tue, 30 Aug 2022 17:25:17 GMT</pubDate>
    <dc:creator>olbapito</dc:creator>
    <dc:date>2022-08-30T17:25:17Z</dc:date>
    <item>
      <title>How to make two searches in the same index but different event types?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-make-two-searches-in-the-same-index-but-different-event/m-p/611332#M212554</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;
&lt;P&gt;I have a log like this&lt;/P&gt;
&lt;P&gt;eventtype=000111 msg=malicious srcip=11.11.22.22&lt;/P&gt;
&lt;P&gt;eventtype=123 msg=traffic srcip=11.11.22.22 hostname=MyMachine&lt;/P&gt;
&lt;P&gt;Both lines are on the same index, would like to get something like this&lt;/P&gt;
&lt;P&gt;eventtype=000111 msg=malicious srcip=11.11.22.22 hostname=MyMachine&lt;/P&gt;
&lt;P&gt;I´ve tryied using joins, but they just could get results when indexes are different. because the initial condition of eventtype doesn´t match with the second event. this is the query which doesn´t work&lt;/P&gt;
&lt;P&gt;index=index_ logid=1122 | fields * |&lt;BR /&gt;join srcip [search index=index_ | table hostname ] |&lt;BR /&gt;table eventtype msg srcip hostname&lt;BR /&gt;&lt;BR /&gt;Can you help me? Thanks!!&lt;/P&gt;</description>
      <pubDate>Tue, 30 Aug 2022 15:32:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-make-two-searches-in-the-same-index-but-different-event/m-p/611332#M212554</guid>
      <dc:creator>olbapito</dc:creator>
      <dc:date>2022-08-30T15:32:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to make two searches in the same index but different event types?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-make-two-searches-in-the-same-index-but-different-event/m-p/611335#M212555</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/249014"&gt;@olbapito&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;it isn't relevant that the events are in the same index with different eventtypes, you could use join (but I don't hint:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=index_ logid=1122 eventtype=000111
| join srcip [ search index=index_ eventtype=123 | table srcip hostname ] 
| table eventtype msg srcip hostname&lt;/LI-CODE&gt;&lt;P&gt;I hint to use a different approach because Splunk isn't a DB and Join is a very slow command;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=index_ ((logid=1122 eventtype=000111) OR eventtype=123)
| stats values(eventtype) AS eventtype values(msg) AS msg values(hostname) AS hostname BY srcip &lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 30 Aug 2022 15:53:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-make-two-searches-in-the-same-index-but-different-event/m-p/611335#M212555</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-08-30T15:53:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to make two searches in the same index but different event types?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-make-two-searches-in-the-same-index-but-different-event/m-p/611350#M212556</link>
      <description>&lt;P&gt;Hi Giuseppe,&lt;/P&gt;&lt;P&gt;I like the way of doing that without join. i´ve notice that joins are terrible slow.&lt;/P&gt;&lt;P&gt;The problem with the example is that it give data that I don´t need. I mean eventtype 000111 is an event which occurs very few times in a week, meanwhile event 123 occurs permanently. both events, 000111 and 123 have the srcip field, but just the event 123 have the hostname field, so I need to having found an unique 000111 event, look for a 123 event which has the same ip address on the same time (around 10 minutes) to take its hostname.&amp;nbsp;&lt;/P&gt;&lt;P&gt;On the query suggested I´m getting ip and hostname for every event which has an 123 event. but they don´t have an 000111 event.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 30 Aug 2022 17:25:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-make-two-searches-in-the-same-index-but-different-event/m-p/611350#M212556</guid>
      <dc:creator>olbapito</dc:creator>
      <dc:date>2022-08-30T17:25:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to make two searches in the same index but different event types?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-make-two-searches-in-the-same-index-but-different-event/m-p/611416#M212588</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/249014"&gt;@olbapito&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;using the above search you display the hostname only if present so the srcips without hostname aren't relevant so you can exclude the results without hostname with a simple search after the stats command:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=index_ ((logid=1122 eventtype=000111) OR eventtype=123)
| stats values(eventtype) AS eventtype values(msg) AS msg values(hostname) AS hostname BY srcip 
| search hostname=*&lt;/LI-CODE&gt;&lt;P&gt;But anyway, if you want you can take the hostname value only from eventtype=123, you can try something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=index_ ((logid=1122 eventtype=000111) OR eventtype=123)
| stats values(eventtype) AS eventtype values(msg) AS msg values(eval(if(eventtype=123,hostname,""))) AS hostname BY srcip &lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 31 Aug 2022 06:28:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-make-two-searches-in-the-same-index-but-different-event/m-p/611416#M212588</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-08-31T06:28:19Z</dc:date>
    </item>
  </channel>
</rss>

