<?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 combine data from indexes with different fields as common results in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-data-from-indexes-with-different-fields-as-common/m-p/643477#M222896</link>
    <description>&lt;P&gt;Hi Team,&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;I have 2 indexes with same data.&lt;/P&gt;&lt;P&gt;In Index1 data is coming with the fields user, action, http_referrer and&amp;nbsp;&lt;/P&gt;&lt;P&gt;In index 2 data is coming with the fields loginid, action, referrer&lt;/P&gt;&lt;P&gt;I want to table the results with common field data from 2 indexes like | table user, action, referrer&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried using eval mvappend it didn't work. Can some one please assist. Thank You.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 16 May 2023 09:05:11 GMT</pubDate>
    <dc:creator>sasankganta</dc:creator>
    <dc:date>2023-05-16T09:05:11Z</dc:date>
    <item>
      <title>How to combine data from indexes with different fields as common results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-data-from-indexes-with-different-fields-as-common/m-p/643477#M222896</link>
      <description>&lt;P&gt;Hi Team,&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;I have 2 indexes with same data.&lt;/P&gt;&lt;P&gt;In Index1 data is coming with the fields user, action, http_referrer and&amp;nbsp;&lt;/P&gt;&lt;P&gt;In index 2 data is coming with the fields loginid, action, referrer&lt;/P&gt;&lt;P&gt;I want to table the results with common field data from 2 indexes like | table user, action, referrer&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried using eval mvappend it didn't work. Can some one please assist. Thank You.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 May 2023 09:05:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-data-from-indexes-with-different-fields-as-common/m-p/643477#M222896</guid>
      <dc:creator>sasankganta</dc:creator>
      <dc:date>2023-05-16T09:05:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine data from indexes with different fields as common results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-data-from-indexes-with-different-fields-as-common/m-p/643480#M222897</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/230155"&gt;@sasankganta&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;you have to use stats to correlate events from different Data Sources, something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=indexA OR index=indexB
| eval referrer=coalesce(http_referrer,referrer)
| stats values(user) AS user values(action) AS action BY referrer&lt;/LI-CODE&gt;&lt;P&gt;if you want to correlate for referrer and user, you can move user field in the BY clause:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=indexA OR index=indexB
| eval referrer=coalesce(http_referrer,referrer)
| stats values(action) AS action BY user referrer&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 May 2023 09:13:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-data-from-indexes-with-different-fields-as-common/m-p/643480#M222897</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-05-16T09:13:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine data from indexes with different fields as common results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-data-from-indexes-with-different-fields-as-common/m-p/643483#M222899</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;, Early I tried this as well before posting. It didn't work.&lt;/P&gt;&lt;P&gt;If I'm doing table / stats for the above data :&lt;/P&gt;&lt;P&gt;In Index1 fields user, action, http_referrer and&amp;nbsp;&lt;/P&gt;&lt;P&gt;In index 2&amp;nbsp; fields loginid, action, referrer&lt;/P&gt;&lt;P&gt;final result in statistics I need user, action, referrer these 3 fields&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 May 2023 09:54:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-data-from-indexes-with-different-fields-as-common/m-p/643483#M222899</guid>
      <dc:creator>sasankganta</dc:creator>
      <dc:date>2023-05-16T09:54:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine data from indexes with different fields as common results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-data-from-indexes-with-different-fields-as-common/m-p/643484#M222900</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/230155"&gt;@sasankganta&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;what do you mean with "it doesn't work"?&lt;/P&gt;&lt;P&gt;it's a result different from the desidered one or there isn't any result?&lt;/P&gt;&lt;P&gt;if you want in each row user, action and referrer, you can use something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=indexA OR index=indexB
| eval referrer=coalesce(http_referrer,referrer)
| stats count BY user action referrer
| fields - count&lt;/LI-CODE&gt;&lt;P&gt;if you haven't any result, check the format of http_referrer and referrer: verify if they have the same format.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 16 May 2023 09:59:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-data-from-indexes-with-different-fields-as-common/m-p/643484#M222900</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-05-16T09:59:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine data from indexes with different fields as common results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-data-from-indexes-with-different-fields-as-common/m-p/643487#M222901</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;None of the above query are working :&lt;BR /&gt;&lt;BR /&gt;sorry if i confused you I will give you more details here:&lt;/P&gt;&lt;P&gt;Index1 data: may 16 04:00:00 10.10.01 vendor=* product=* user=xxxx action=allowed&amp;nbsp;&lt;SPAN&gt;http_referrer=https:google.com&lt;BR /&gt;&lt;BR /&gt;Index2 data:&amp;nbsp;&amp;nbsp;may 16 04:00:00 10.10.01 vendor=* product=* LoginID=xxxx action=allowed&amp;nbsp;referrer=https:google.com&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;In above log data is same but filed names are changed. Now I want to name common filed in my results and&amp;nbsp;I want results in below format in statistics:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;action&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; user&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;referrer&lt;BR /&gt;&amp;nbsp; allowed&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;sasank&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; https:google.com&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; allowed&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;sasank&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; https:google.com&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 16 May 2023 10:55:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-data-from-indexes-with-different-fields-as-common/m-p/643487#M222901</guid>
      <dc:creator>sasankganta</dc:creator>
      <dc:date>2023-05-16T10:55:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine data from indexes with different fields as common results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-data-from-indexes-with-different-fields-as-common/m-p/643488#M222902</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/230155"&gt;@sasankganta&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;let me understand: loginID has the same values of user?&lt;/P&gt;&lt;P&gt;if yes, you can use eval coalesce to gibe the same field name:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=indexA OR index=indexB
| eval referrer=coalesce(http_referrer,referrer), user=coalesce(user,LoginID)
| stats count BY user action referrer
| fields - count&lt;/LI-CODE&gt;&lt;P&gt;if they are different:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=indexA OR index=indexB
| eval referrer=coalesce(http_referrer,referrer)
| stats values(user) AS user BY action referrer
| mvexpand user&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 May 2023 11:20:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-data-from-indexes-with-different-fields-as-common/m-p/643488#M222902</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-05-16T11:20:10Z</dc:date>
    </item>
  </channel>
</rss>

