<?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 Two searches using three indexes with different fields in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Two-searches-using-three-indexes-with-different-fields/m-p/440589#M125265</link>
    <description>&lt;P&gt;I have this search below:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=BI_1 sourcetype=jobs_info fieldJ IN (Flamengo)
| search index=BI_2 sourcetype=tel_drv
| dedup _raw
| eval indextime = strftime(_indextime, "%Y-%m-%d")
| stats sum(TNeg) as TNeg_drv by indextime
| appendcols [search index=BI_3 sourcetype=tel_eqt | dedup _raw | eval indextime = strftime(_indextime, "%Y-%m-%d") | stats sum(TNeg) as TNeg_eqt by indextime]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And need to sum the fields  &lt;CODE&gt;"TNeg_eqt" "TNeg_drv"&lt;/CODE&gt; then show in the table with the indextime but I'm having difficulties.&lt;/P&gt;</description>
    <pubDate>Mon, 24 Jun 2019 17:33:04 GMT</pubDate>
    <dc:creator>nsantiago17</dc:creator>
    <dc:date>2019-06-24T17:33:04Z</dc:date>
    <item>
      <title>Two searches using three indexes with different fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Two-searches-using-three-indexes-with-different-fields/m-p/440589#M125265</link>
      <description>&lt;P&gt;I have this search below:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=BI_1 sourcetype=jobs_info fieldJ IN (Flamengo)
| search index=BI_2 sourcetype=tel_drv
| dedup _raw
| eval indextime = strftime(_indextime, "%Y-%m-%d")
| stats sum(TNeg) as TNeg_drv by indextime
| appendcols [search index=BI_3 sourcetype=tel_eqt | dedup _raw | eval indextime = strftime(_indextime, "%Y-%m-%d") | stats sum(TNeg) as TNeg_eqt by indextime]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And need to sum the fields  &lt;CODE&gt;"TNeg_eqt" "TNeg_drv"&lt;/CODE&gt; then show in the table with the indextime but I'm having difficulties.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jun 2019 17:33:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Two-searches-using-three-indexes-with-different-fields/m-p/440589#M125265</guid>
      <dc:creator>nsantiago17</dc:creator>
      <dc:date>2019-06-24T17:33:04Z</dc:date>
    </item>
    <item>
      <title>Re: Two searches using three indexes with different fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Two-searches-using-three-indexes-with-different-fields/m-p/440590#M125266</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/180706"&gt;@nsantiago17&lt;/a&gt; ,&lt;/P&gt;

&lt;P&gt;Some sample data would be helpful, along with how you would like to the report/table to look.  Some questions:&lt;BR /&gt;
What is TNeg_eqt?  What is TNeg_drv?  What is the unique value for these events (transaction ID, line number, serial number, etc)? Why are you using dedup?&lt;/P&gt;

&lt;P&gt;I would use something like this:&lt;BR /&gt;
&lt;PRE&gt;&lt;BR /&gt;
( index=BI_1 sourcetype=jobs_info fieldJ IN (Flamengo) ) OR &lt;BR /&gt;
( index=BI_2 sourcetype=tel_drv )&lt;BR /&gt;
| eventstats sum(TNeg_eqt) as TNeg_eqtSum sum(TNeg_drv) as TNeg_drvSum&lt;BR /&gt;
&lt;/PRE&gt;&lt;/P&gt;

&lt;P&gt;This search will show the sum of each value as an additional field.  If you just want the total sum and no other information, you could use stats:&lt;BR /&gt;
&lt;PRE&gt;&lt;BR /&gt;
( index=BI_1 sourcetype=jobs_info fieldJ IN (Flamengo) ) OR &lt;BR /&gt;
( index=BI_2 sourcetype=tel_drv )&lt;BR /&gt;
| stats sum(TNeg_eqt) as TNeg_eqtSum sum(TNeg_drv) as TNeg_drvSum&lt;/PRE&gt;&lt;/P&gt;

&lt;P&gt;If the fields are named differently between indexes, you would use an eval to create the regular field:&lt;BR /&gt;
&lt;PRE&gt;&lt;BR /&gt;
( index=BI_1 sourcetype=jobs_info fieldJ IN (Flamengo) ) OR &lt;BR /&gt;
( index=BI_2 sourcetype=tel_drv )&lt;BR /&gt;
| eval TNeg_eqt = case(index=="BI_1", TNeg_eqt_BI_1, index=="BI_2", neg_BI_2)&lt;BR /&gt;
| eval TNeg_drv = case(index=="BI_1", TNeg_drv_BI_1, index=="BI_2", drv_BI_2)&lt;BR /&gt;
| stats sum(TNeg_eqt) as TNeg_eqtSum sum(TNeg_drv) as TNeg_drvSum&lt;/PRE&gt;&lt;/P&gt;

&lt;P&gt;Without knowing more about your data, it's hard to provide an accurate answer.&lt;/P&gt;

&lt;P&gt;Also, when you do a &lt;CODE&gt;| stats sum(x) by _time&lt;/CODE&gt; you're usually only going to end up with the same number in the stats calculation because _time will most likely be unique, unless you're using &lt;CODE&gt;bucket&lt;/CODE&gt; or &lt;CODE&gt;bin&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:02:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Two-searches-using-three-indexes-with-different-fields/m-p/440590#M125266</guid>
      <dc:creator>jnudell_2</dc:creator>
      <dc:date>2020-09-30T01:02:59Z</dc:date>
    </item>
    <item>
      <title>Re: Two searches using three indexes with different fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Two-searches-using-three-indexes-with-different-fields/m-p/440591#M125267</link>
      <description>&lt;P&gt;Hi, &lt;BR /&gt;
It's not easy to show some sample bc I'm dealing with classified data and I'm afraid that can be prejudicial to me thats the reason.&lt;BR /&gt;
TNeg_eqt and the other one are variable that I receive from the source and they are numbers of negociations per day. The dedup was sent wrong so I apologize for that. All I need is to generate a table that contains the _time, TNeg_eqt* and TNeg_drv*. Then I can add some other fields that belong to the index (BI_1)&lt;/P&gt;

&lt;P&gt;*Those guys have the same index (BI_2) but different sourcetypes and in each one of them I have different fields to extract.&lt;/P&gt;

&lt;P&gt;I hope it makes easier to understand but it's complicated to show everything that I need help, thanks again;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:03:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Two-searches-using-three-indexes-with-different-fields/m-p/440591#M125267</guid>
      <dc:creator>nsantiago17</dc:creator>
      <dc:date>2020-09-30T01:03:02Z</dc:date>
    </item>
    <item>
      <title>Re: Two searches using three indexes with different fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Two-searches-using-three-indexes-with-different-fields/m-p/440592#M125268</link>
      <description>&lt;P&gt;I updated the answer to try and provide more information.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jun 2019 19:03:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Two-searches-using-three-indexes-with-different-fields/m-p/440592#M125268</guid>
      <dc:creator>jnudell_2</dc:creator>
      <dc:date>2019-06-24T19:03:30Z</dc:date>
    </item>
    <item>
      <title>Re: Two searches using three indexes with different fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Two-searches-using-three-indexes-with-different-fields/m-p/440593#M125269</link>
      <description>&lt;P&gt;Worked well, I really appreciate your help.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jun 2019 13:11:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Two-searches-using-three-indexes-with-different-fields/m-p/440593#M125269</guid>
      <dc:creator>nsantiago17</dc:creator>
      <dc:date>2019-06-25T13:11:51Z</dc:date>
    </item>
  </channel>
</rss>

