<?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: How to associate and create fields between 2 JSON events? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-associate-and-create-fields-between-2-JSON-events/m-p/252435#M75548</link>
    <description>&lt;P&gt;@somesoni2, you're awesome Sir!&lt;/P&gt;

&lt;P&gt;I did exactly what you said: source type override with transforms/props and filtering with sub search + using join to aggregate fields and my queries are flying.&lt;/P&gt;

&lt;P&gt;Thanks again!&lt;/P&gt;</description>
    <pubDate>Tue, 06 Oct 2015 00:04:18 GMT</pubDate>
    <dc:creator>jeanmatthieu</dc:creator>
    <dc:date>2015-10-06T00:04:18Z</dc:date>
    <item>
      <title>How to associate and create fields between 2 JSON events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-associate-and-create-fields-between-2-JSON-events/m-p/252430#M75543</link>
      <description>&lt;P&gt;Hey Everyone,&lt;/P&gt;

&lt;P&gt;I'm trying to extract fields from an event using a somewhat similar foreign key concept/mechanism.&lt;BR /&gt;
For the two events as below:&lt;/P&gt;

&lt;P&gt;Event#1&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{
   colour=blue,
   metadata_id=1234-56,
   record_type=car
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Event#2&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; {
       material=plastic,
       country_of_origin=germany
       metadata_id=1234-56,
       record_type=metadata
    }
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I would like to be able to add to Event#1 the &lt;STRONG&gt;material&lt;/STRONG&gt; and &lt;STRONG&gt;country_of_origin&lt;/STRONG&gt; fields so I can easily search for all blue cars made in Germany as such:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=cars country_of_origin=germany colour=blue record_type=car
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Could you kindly suggest how I could build fields using &lt;STRONG&gt;metadata_id&lt;/STRONG&gt; as a foreign key in Event#1 that extracts the necessary info from Event #2 ?&lt;/P&gt;

&lt;P&gt;Thank you!&lt;BR /&gt;
Jean-Matthieu&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 07:26:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-associate-and-create-fields-between-2-JSON-events/m-p/252430#M75543</guid>
      <dc:creator>jeanmatthieu</dc:creator>
      <dc:date>2020-09-29T07:26:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to associate and create fields between 2 JSON events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-associate-and-create-fields-between-2-JSON-events/m-p/252431#M75544</link>
      <description>&lt;P&gt;Both events appears on the same index/sourcetype??&lt;/P&gt;</description>
      <pubDate>Thu, 01 Oct 2015 22:22:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-associate-and-create-fields-between-2-JSON-events/m-p/252431#M75544</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2015-10-01T22:22:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to associate and create fields between 2 JSON events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-associate-and-create-fields-between-2-JSON-events/m-p/252432#M75545</link>
      <description>&lt;P&gt;They do indeed -- it would be difficult to post to a different source type as events are received through a tcp port on a heavy forwarder and safely brought to our backend afterwards. Thanks !&lt;/P&gt;</description>
      <pubDate>Thu, 01 Oct 2015 22:31:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-associate-and-create-fields-between-2-JSON-events/m-p/252432#M75545</guid>
      <dc:creator>jeanmatthieu</dc:creator>
      <dc:date>2015-10-01T22:31:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to associate and create fields between 2 JSON events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-associate-and-create-fields-between-2-JSON-events/m-p/252433#M75546</link>
      <description>&lt;P&gt;Since they are in same index/sourcetype but present in different event, you will not be able to do filters, like you need, directly. You would need to do some processing (correlation) before the filter. Something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=cars | table colr, metadata_id, record_type, material, country_of_origin | stats values(*) as * by metadata_id | search country_of_origin=germany colour=blue record_type=car
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For long term, you can assign different sourcetype from same data source, based on regular expression.  See this&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.4/Data/Advancedsourcetypeoverrides"&gt;http://docs.splunk.com/Documentation/Splunk/6.2.4/Data/Advancedsourcetypeoverrides&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Once you've the color (any attribute which appears less number of time) on different sourcetype, Then you may have different options, like you can create a lookup table and use that as filter, OR use the 2nd sourcetype as subsearch filter etc.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Oct 2015 22:58:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-associate-and-create-fields-between-2-JSON-events/m-p/252433#M75546</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2015-10-01T22:58:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to associate and create fields between 2 JSON events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-associate-and-create-fields-between-2-JSON-events/m-p/252434#M75547</link>
      <description>&lt;P&gt;Thank you for pointing me to the advanced source type override. &lt;BR /&gt;
I should probably implement that first as follow&lt;BR /&gt;
In &lt;CODE&gt;transforms.conf&lt;/CODE&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[my_car_metadata]
REGEX = *.record_type=metadata.*
FORMAT = sourcetype::car_metadata
DEST_KEY = MetaData:Sourcetype
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In props.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[original_sourcetype]
TRANSFORMS-car_metatdata_sourcetype = my_car_metadata
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Of your two suggestions (creating and using lookup table as a filter and sub search) I would not know which one is the most efficient. Would you be able to illustrate one technique please ? I have seen the ease of CSV lookups before and was hoping for a similar solution with JSON based events.&lt;/P&gt;

&lt;P&gt;On a side note, naming convention in props.conf looks like a strategy of its own !&lt;/P&gt;

&lt;P&gt;Thank again for your prompt help!&lt;/P&gt;</description>
      <pubDate>Thu, 01 Oct 2015 23:24:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-associate-and-create-fields-between-2-JSON-events/m-p/252434#M75547</guid>
      <dc:creator>jeanmatthieu</dc:creator>
      <dc:date>2015-10-01T23:24:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to associate and create fields between 2 JSON events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-associate-and-create-fields-between-2-JSON-events/m-p/252435#M75548</link>
      <description>&lt;P&gt;@somesoni2, you're awesome Sir!&lt;/P&gt;

&lt;P&gt;I did exactly what you said: source type override with transforms/props and filtering with sub search + using join to aggregate fields and my queries are flying.&lt;/P&gt;

&lt;P&gt;Thanks again!&lt;/P&gt;</description>
      <pubDate>Tue, 06 Oct 2015 00:04:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-associate-and-create-fields-between-2-JSON-events/m-p/252435#M75548</guid>
      <dc:creator>jeanmatthieu</dc:creator>
      <dc:date>2015-10-06T00:04:18Z</dc:date>
    </item>
  </channel>
</rss>

