<?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: Join data from 2 indexes in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Join-data-from-2-indexes/m-p/668055#M229204</link>
    <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/244375"&gt;@sekhar463&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;please try this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=_internal sourcetype=splunkd source="/opt/splunk/var/log/splunk/metrics.log" group=tcpin_connections [ search index="INDEX1" "\" (puppet-agent OR puppet) AND *Error* AND "/Stage["
| rename host AS hostname | fields hostname ]
| table hostname sourceIp
| dedup hostname&lt;/LI-CODE&gt;&lt;P&gt;there was a wrong parenthesis.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
    <pubDate>Thu, 09 Nov 2023 11:25:38 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2023-11-09T11:25:38Z</dc:date>
    <item>
      <title>Join data from 2 indexes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-data-from-2-indexes/m-p/667566#M229019</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;i have 2 indexes having below 2 queries&amp;nbsp;&lt;/P&gt;
&lt;P&gt;host,hostname are common for both,&amp;nbsp; want to add&amp;nbsp;sourceIp using 2nd search&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;How to join ?&lt;/P&gt;
&lt;P&gt;query 1&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index="index1" \ (puppet-agent OR puppet)) AND *Error* AND "/Stage["
| table host&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;query2;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=_internal sourcetype=splunkd source="/opt/splunk/var/log/splunk/metrics.log" group=tcpin_connections
| table hostname sourceIp
| dedup hostname&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 06 Nov 2023 16:56:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-data-from-2-indexes/m-p/667566#M229019</guid>
      <dc:creator>sekhar463</dc:creator>
      <dc:date>2023-11-06T16:56:45Z</dc:date>
    </item>
    <item>
      <title>Re: Join data from 2 indexes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-data-from-2-indexes/m-p/667570#M229022</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/244375"&gt;@sekhar463&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;let me understand: do you want only hosts present in both searches or what's the rule?&lt;/P&gt;&lt;P&gt;if present in both searches:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=_internal sourcetype=splunkd source="/opt/splunk/var/log/splunk/metrics.log" group=tcpin_connections [ search index="index1" \ (puppet-agent OR puppet)) AND *Error* AND "/Stage["
| rename host AS hostname | fields hostname ]
| table hostname sourceIp
| dedup hostname&lt;/LI-CODE&gt;&lt;P&gt;Ths search runs if results are less than 50,000, if they are more than 50,000 you need a different approach:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(index=_internal sourcetype=splunkd source="/opt/splunk/var/log/splunk/metrics.log" group=tcpin_connections) OR (index="index1" \ (puppet-agent OR puppet)) AND *Error* AND "/Stage[")
| eval hostname=coalesce(hostname,host)
| stats values(sourceIp) AS sourceIp dc(index) AS index_count BY hostname
| where index_count=2
| fields - index_count&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 06 Nov 2023 16:02:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-data-from-2-indexes/m-p/667570#M229022</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-11-06T16:02:52Z</dc:date>
    </item>
    <item>
      <title>Re: Join data from 2 indexes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-data-from-2-indexes/m-p/668044#M229201</link>
      <description>&lt;P&gt;getting error&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV&gt;&lt;DIV class=""&gt;Error in 'search' command: Unable to parse the search: unbalanced parentheses using below search&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;index=_internal sourcetype=splunkd source="/opt/splunk/var/log/splunk/metrics.log" group=tcpin_connections [ search index="INDEX1" \ (puppet-agent OR puppet)) AND *Error* AND "/Stage["&lt;BR /&gt;| rename host AS hostname | fields hostname ]&lt;BR /&gt;| table hostname sourceIp&lt;BR /&gt;| dedup hostname&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 09 Nov 2023 10:04:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-data-from-2-indexes/m-p/668044#M229201</guid>
      <dc:creator>sekhar463</dc:creator>
      <dc:date>2023-11-09T10:04:24Z</dc:date>
    </item>
    <item>
      <title>Re: Join data from 2 indexes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-data-from-2-indexes/m-p/668055#M229204</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/244375"&gt;@sekhar463&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;please try this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=_internal sourcetype=splunkd source="/opt/splunk/var/log/splunk/metrics.log" group=tcpin_connections [ search index="INDEX1" "\" (puppet-agent OR puppet) AND *Error* AND "/Stage["
| rename host AS hostname | fields hostname ]
| table hostname sourceIp
| dedup hostname&lt;/LI-CODE&gt;&lt;P&gt;there was a wrong parenthesis.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 09 Nov 2023 11:25:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-data-from-2-indexes/m-p/668055#M229204</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-11-09T11:25:38Z</dc:date>
    </item>
    <item>
      <title>Re: Join data from 2 indexes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-data-from-2-indexes/m-p/668524#M229334</link>
      <description>&lt;P&gt;individual search is working for below which extracts host_name field and joining with host_name field in search but getting error "&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV&gt;&lt;DIV class=""&gt;Error in 'rex' command: Invalid argument: '('&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;index=_internal sourcetype=splunkd source="/opt/splunk/var/log/splunk/metrics.log"&lt;BR /&gt;| rex field=hostname "(?&amp;lt;host_name&amp;gt;[^.]+)\."&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;but its giving less results when using below search but individual search has many&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;here is the full query&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;index=_internal sourcetype=splunkd source="/opt/splunk/var/log/splunk/metrics.log"&lt;BR /&gt;| rex field=hostname "(?&amp;lt;host_name&amp;gt;[^.]+)\."&lt;BR /&gt;[&lt;BR /&gt;&lt;BR /&gt;| table host_name, sourceIp&lt;/P&gt;</description>
      <pubDate>Wed, 15 Nov 2023 10:08:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-data-from-2-indexes/m-p/668524#M229334</guid>
      <dc:creator>sekhar463</dc:creator>
      <dc:date>2023-11-15T10:08:59Z</dc:date>
    </item>
    <item>
      <title>Re: Join data from 2 indexes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-data-from-2-indexes/m-p/668529#M229335</link>
      <description>&lt;P&gt;1. This part&lt;/P&gt;&lt;PRE&gt;| table hostname sourceIp
| dedup hostname&lt;/PRE&gt;&lt;P&gt;You realize that you will lose additional IP addresses on multihomed hosts?&lt;/P&gt;&lt;P&gt;2. Depending on your data (number of results, size of raw events, time of each search execution) there could be different ways to do that.&lt;/P&gt;&lt;P&gt;There is a "join" command but its use is generally discouraged.&lt;/P&gt;&lt;P&gt;The typical way is to either append two result sets and do stats by the common field(s) or do a search across two sets, classify the fields into one of the sets (possibly rename fields) and then do the stats.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Nov 2023 12:56:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-data-from-2-indexes/m-p/668529#M229335</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2023-11-14T12:56:22Z</dc:date>
    </item>
    <item>
      <title>Re: Join data from 2 indexes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-data-from-2-indexes/m-p/668551#M229336</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/244375"&gt;@sekhar463&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;please try this regex:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=hostname "(?&amp;lt;host_name&amp;gt;[^\.]+)\."&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 14 Nov 2023 13:55:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-data-from-2-indexes/m-p/668551#M229336</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-11-14T13:55:42Z</dc:date>
    </item>
  </channel>
</rss>

