<?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 How to populate column in results using two indexes? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-populate-column-in-results-using-two-indexes/m-p/436982#M124486</link>
    <description>&lt;P&gt;Hello all - &lt;/P&gt;

&lt;P&gt;Trying to figure out how to return the table below when using two index/sourcetypes.  I'd like to do some eval by index and then check whether the respective index has an event so I can add yes | no to the respective column. The common field would be IP and either the IP will have both or one or the other defined. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;indexA
ip=1.1.1.1 app-id=3.09
ip=3.3.3.3 app-id=2.11

indexB
ip=1.1.1.1 rel=release39
ip=2.2.2.2 rel=release12

Desired Results
IP        Release    App-id
1.1.1.1   yes           yes
2.2.2.2   yes          no
3.3.3.3   no            yes
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 11 Mar 2019 15:52:45 GMT</pubDate>
    <dc:creator>splunker1981</dc:creator>
    <dc:date>2019-03-11T15:52:45Z</dc:date>
    <item>
      <title>How to populate column in results using two indexes?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-populate-column-in-results-using-two-indexes/m-p/436982#M124486</link>
      <description>&lt;P&gt;Hello all - &lt;/P&gt;

&lt;P&gt;Trying to figure out how to return the table below when using two index/sourcetypes.  I'd like to do some eval by index and then check whether the respective index has an event so I can add yes | no to the respective column. The common field would be IP and either the IP will have both or one or the other defined. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;indexA
ip=1.1.1.1 app-id=3.09
ip=3.3.3.3 app-id=2.11

indexB
ip=1.1.1.1 rel=release39
ip=2.2.2.2 rel=release12

Desired Results
IP        Release    App-id
1.1.1.1   yes           yes
2.2.2.2   yes          no
3.3.3.3   no            yes
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Mar 2019 15:52:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-populate-column-in-results-using-two-indexes/m-p/436982#M124486</guid>
      <dc:creator>splunker1981</dc:creator>
      <dc:date>2019-03-11T15:52:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to populate column in results using two indexes?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-populate-column-in-results-using-two-indexes/m-p/436983#M124487</link>
      <description>&lt;P&gt;Does this do what you need?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=indexA OR index=indexB 
| stats values(rel) as Release values(app-id) as "App-id" by ip
| rename ip as IP
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Mar 2019 15:58:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-populate-column-in-results-using-two-indexes/m-p/436983#M124487</guid>
      <dc:creator>chrisyounger</dc:creator>
      <dc:date>2019-03-11T15:58:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to populate column in results using two indexes?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-populate-column-in-results-using-two-indexes/m-p/436984#M124488</link>
      <description>&lt;P&gt;Hi splunker1981,&lt;BR /&gt;
if you want to list all the IPs where there's at least Release=yes or App-id=yes, try something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=indexA OR index=indexB
| stats dc(rel) AS rel dc(app-id) AS app-id BY ip
| eval Release=if(rel&amp;gt;0,"yes","not"), App-id=if(app-id&amp;gt;0,"yes","not")
| rename ip AS IP
| table IP Release App-id
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you could have also both Release=not and App-id=not, you have to try something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=indexA OR index=indexB
| stats dc(rel) AS rel dc(app-id) AS app-id BY ip
| eval Release=if(rel&amp;gt;0,"yes","not"), App-id=if(app-id&amp;gt;0,"yes","not")
| append [  search index=indexA NOT app-id=* | eval App-id="not" | fields ip App-id]
| append [  search index=indexB NOT rel=* | eval Release="not" | fields ip Release ]
| stats values(Release) AS Release values(App-id) AS App-id BY ip
| rename ip AS IP
| table IP Release App-id
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 11 Mar 2019 16:13:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-populate-column-in-results-using-two-indexes/m-p/436984#M124488</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2019-03-11T16:13:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to populate column in results using two indexes?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-populate-column-in-results-using-two-indexes/m-p/436985#M124489</link>
      <description>&lt;P&gt;Hi splunker1981,&lt;BR /&gt;
if you're satisfied by this answer, please accept and/or upvote it.&lt;/P&gt;

&lt;P&gt;Bye, see next time.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2019 12:52:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-populate-column-in-results-using-two-indexes/m-p/436985#M124489</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2019-07-31T12:52:26Z</dc:date>
    </item>
  </channel>
</rss>

