<?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: merge two sourcetypes that have the same data but different field names in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/merge-two-sourcetypes-that-have-the-same-data-but-different/m-p/493244#M137577</link>
    <description>&lt;P&gt;Hi  supersnedz,&lt;/P&gt;

&lt;P&gt;Understood.&lt;/P&gt;

&lt;P&gt;You can try below command .&lt;/P&gt;

&lt;P&gt;index=siem_cyber_ca (sourcetype= "cs:epv:cef" OR sourcetype="cs:pta:cef")  | rex field=_raw ((externalid=)\"\\\"|(cs1=)\")(?P[a-z0-9-]*) | stats count(xyz) as XYZ by XYZ . &lt;/P&gt;

&lt;P&gt;You don't need to rename field  . The regex command will create new/rename  field. &lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
Abhijeet B.&lt;/P&gt;</description>
    <pubDate>Wed, 30 Sep 2020 03:58:00 GMT</pubDate>
    <dc:creator>abhijeet01</dc:creator>
    <dc:date>2020-09-30T03:58:00Z</dc:date>
    <item>
      <title>merge two sourcetypes that have the same data but different field names</title>
      <link>https://community.splunk.com/t5/Splunk-Search/merge-two-sourcetypes-that-have-the-same-data-but-different/m-p/493240#M137573</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I have two sourcetypes in the same index, however the fields names are different. Is it possible to rename both fields to the same and then search for a value in the newly named field?&lt;/P&gt;

&lt;P&gt;Both my sourcetypes and fields are as follows:&lt;/P&gt;

&lt;P&gt;index=siem_cyber_ca sourcetype=cs:epv:cef externalid="\\"0538ef14-4281-11ea-a80f-005056af449f\\""&lt;BR /&gt;
index=siem_cyber_ca sourcetype=cs:pta:cef cs1="0538ef14-4281-11ea-a80f-005056af449f"&lt;/P&gt;

&lt;P&gt;I would like both externalid and cs1 to be called the same name, so i can search for 0538ef14-4281-11ea-a80f-005056af449f and recieve both set of results.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 03:51:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/merge-two-sourcetypes-that-have-the-same-data-but-different/m-p/493240#M137573</guid>
      <dc:creator>supersnedz</dc:creator>
      <dc:date>2020-09-30T03:51:25Z</dc:date>
    </item>
    <item>
      <title>Re: merge two sourcetypes that have the same data but different field names</title>
      <link>https://community.splunk.com/t5/Splunk-Search/merge-two-sourcetypes-that-have-the-same-data-but-different/m-p/493241#M137574</link>
      <description>&lt;P&gt;Hi @supersnedz,&lt;BR /&gt;
you can follow two ways:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;create for one of the sourcetypes an alias for the field (e.g. &lt;CODE&gt;cs1 AS externalid&lt;/CODE&gt;) in [Settings -- Fields -- Field Aliases];&lt;/LI&gt;
&lt;LI&gt;use eval and coalesce in your searches e.g. &lt;CODE&gt;index=siem_cyber_ca | eval externalid=coalesce(externalid,cs1)&lt;/CODE&gt;.&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;There's also a third choice because I see that the field value in externalid is a little bit different than cs1: extract from externalid the value using rex: &lt;CODE&gt;| rex field=externalid "\"\\\\\\\"(?&amp;lt;externalid&amp;gt;[^\!]*)"&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2020 15:23:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/merge-two-sourcetypes-that-have-the-same-data-but-different/m-p/493241#M137574</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-01-29T15:23:28Z</dc:date>
    </item>
    <item>
      <title>Re: merge two sourcetypes that have the same data but different field names</title>
      <link>https://community.splunk.com/t5/Splunk-Search/merge-two-sourcetypes-that-have-the-same-data-but-different/m-p/493242#M137575</link>
      <description>&lt;P&gt;If I understand the question, there are a few ways to do that.  The first is with &lt;CODE&gt;OR&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=siem_cyber_ca (sourcetype=cs:epv:cef OR sourcetype=cs:pta:cef) (externalid=foo OR cs1=foo)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or you could give both fields a common name and then search them.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=siem_cyber_ca (sourcetype=cs:epv:cef OR sourcetype=cs:pta:cef) (externalid=* OR cs1=*)
| eval searchField = coalesce(externalid, cs1)
| search searchField = foo
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Like you suggested, you could also rename both fields.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=siem_cyber_ca (sourcetype=cs:epv:cef OR sourcetype=cs:pta:cef) (externalid=* OR cs1=*)
| rename externalid as searchField, cs1 as searchField
| search searchField = foo
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 Jan 2020 15:24:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/merge-two-sourcetypes-that-have-the-same-data-but-different/m-p/493242#M137575</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-01-29T15:24:32Z</dc:date>
    </item>
    <item>
      <title>Re: merge two sourcetypes that have the same data but different field names</title>
      <link>https://community.splunk.com/t5/Splunk-Search/merge-two-sourcetypes-that-have-the-same-data-but-different/m-p/493243#M137576</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;Fields » Calculated fields » Add new

Destination app: search   
Apply to sourcetype  named: cs:epv:cef
Name: cs1
Eval expression:  coalesce(replace(externalid,"\\\\\"",""),cs1)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hi, try &lt;EM&gt;Calculated fields&lt;/EM&gt; and use  fieldname &lt;CODE&gt;cs1&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults
|eval externalid="\\\"0538ef14-4281-11ea-a80f-005056af449f\\\""
|eval cs1=coalesce(replace(externalid,"\\\\\"",""),cs1)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;the result is like above.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jan 2020 06:20:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/merge-two-sourcetypes-that-have-the-same-data-but-different/m-p/493243#M137576</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-01-30T06:20:18Z</dc:date>
    </item>
    <item>
      <title>Re: merge two sourcetypes that have the same data but different field names</title>
      <link>https://community.splunk.com/t5/Splunk-Search/merge-two-sourcetypes-that-have-the-same-data-but-different/m-p/493244#M137577</link>
      <description>&lt;P&gt;Hi  supersnedz,&lt;/P&gt;

&lt;P&gt;Understood.&lt;/P&gt;

&lt;P&gt;You can try below command .&lt;/P&gt;

&lt;P&gt;index=siem_cyber_ca (sourcetype= "cs:epv:cef" OR sourcetype="cs:pta:cef")  | rex field=_raw ((externalid=)\"\\\"|(cs1=)\")(?P[a-z0-9-]*) | stats count(xyz) as XYZ by XYZ . &lt;/P&gt;

&lt;P&gt;You don't need to rename field  . The regex command will create new/rename  field. &lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
Abhijeet B.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 03:58:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/merge-two-sourcetypes-that-have-the-same-data-but-different/m-p/493244#M137577</guid>
      <dc:creator>abhijeet01</dc:creator>
      <dc:date>2020-09-30T03:58:00Z</dc:date>
    </item>
    <item>
      <title>Re: merge two sourcetypes that have the same data but different field names</title>
      <link>https://community.splunk.com/t5/Splunk-Search/merge-two-sourcetypes-that-have-the-same-data-but-different/m-p/493245#M137578</link>
      <description>&lt;P&gt;please use &lt;CODE&gt;code sample&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jan 2020 08:54:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/merge-two-sourcetypes-that-have-the-same-data-but-different/m-p/493245#M137578</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-01-30T08:54:52Z</dc:date>
    </item>
    <item>
      <title>Re: merge two sourcetypes that have the same data but different field names</title>
      <link>https://community.splunk.com/t5/Splunk-Search/merge-two-sourcetypes-that-have-the-same-data-but-different/m-p/493246#M137579</link>
      <description>&lt;P&gt;Thank you this works wonders&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jan 2020 10:57:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/merge-two-sourcetypes-that-have-the-same-data-but-different/m-p/493246#M137579</guid>
      <dc:creator>supersnedz</dc:creator>
      <dc:date>2020-01-30T10:57:53Z</dc:date>
    </item>
    <item>
      <title>Re: merge two sourcetypes that have the same data but different field names</title>
      <link>https://community.splunk.com/t5/Splunk-Search/merge-two-sourcetypes-that-have-the-same-data-but-different/m-p/493247#M137580</link>
      <description>&lt;P&gt;Thank you, at first i had unbalanced quotes, but its sorted. Thanks again&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jan 2020 10:58:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/merge-two-sourcetypes-that-have-the-same-data-but-different/m-p/493247#M137580</guid>
      <dc:creator>supersnedz</dc:creator>
      <dc:date>2020-01-30T10:58:50Z</dc:date>
    </item>
  </channel>
</rss>

