<?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 transform raw JSON with field called 'index' in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-transform-raw-JSON-with-field-called-index/m-p/576308#M101838</link>
    <description>Hi, I have json data being written to a log file and the log file is being forwarded to single Splunk index 'ti-l_asl'. The problem I have is the json data contains a field called 'index' which I want to transform into 'sourcetype' so it can be search on in Splunk. Is there a way I can do this without changing the system which writes the json to the log file i.e. transform the field name from 'index' to 'sourcetype' as part of the forwarder processing or some kind of pre-processing in Splunk before it is assigned to index 'ti-l_asl' ?</description>
    <pubDate>Thu, 25 Nov 2021 11:48:04 GMT</pubDate>
    <dc:creator>jon_radford</dc:creator>
    <dc:date>2021-11-25T11:48:04Z</dc:date>
    <item>
      <title>How to transform raw JSON with field called 'index'</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-transform-raw-JSON-with-field-called-index/m-p/576308#M101838</link>
      <description>Hi, I have json data being written to a log file and the log file is being forwarded to single Splunk index 'ti-l_asl'. The problem I have is the json data contains a field called 'index' which I want to transform into 'sourcetype' so it can be search on in Splunk. Is there a way I can do this without changing the system which writes the json to the log file i.e. transform the field name from 'index' to 'sourcetype' as part of the forwarder processing or some kind of pre-processing in Splunk before it is assigned to index 'ti-l_asl' ?</description>
      <pubDate>Thu, 25 Nov 2021 11:48:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-transform-raw-JSON-with-field-called-index/m-p/576308#M101838</guid>
      <dc:creator>jon_radford</dc:creator>
      <dc:date>2021-11-25T11:48:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to transform raw JSON with field called 'index'</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-transform-raw-JSON-with-field-called-index/m-p/576309#M101839</link>
      <description>&lt;P&gt;In general, if you leave the "index" field as is, you might have problems searching. Even if you add sourcetype based on that field value (which I suppose is possible using transforms and rewriting metadata), you'll still have a field called "index" in your event which will overlap with searching from a particular index.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Nov 2021 12:00:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-transform-raw-JSON-with-field-called-index/m-p/576309#M101839</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2021-11-25T12:00:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to transform raw JSON with field called 'index'</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-transform-raw-JSON-with-field-called-index/m-p/576321#M101840</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231884"&gt;@PickleRick&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Having the index value in Splunk does not seem to affect searching, but I can only search on the Splunk index and not the data index value. How would I achieve the mapping using transforms or rewriting metadata?&lt;/P&gt;</description>
      <pubDate>Thu, 25 Nov 2021 13:08:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-transform-raw-JSON-with-field-called-index/m-p/576321#M101840</guid>
      <dc:creator>jon_radford</dc:creator>
      <dc:date>2021-11-25T13:08:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to transform raw JSON with field called 'index'</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-transform-raw-JSON-with-field-called-index/m-p/576322#M101841</link>
      <description>&lt;P&gt;That's what I'm talking about. You can't use the index field of the event to search. You just search by the index. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/SplunkCloud/latest/Data/Advancedsourcetypeoverrides" target="_blank"&gt;https://docs.splunk.com/Documentation/SplunkCloud/latest/Data/Advancedsourcetypeoverrides&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Nov 2021 13:33:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-transform-raw-JSON-with-field-called-index/m-p/576322#M101841</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2021-11-25T13:33:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to transform raw JSON with field called 'index'</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-transform-raw-JSON-with-field-called-index/m-p/576331#M101842</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231884"&gt;@PickleRick&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, to be clear, by using a heavy forwarder it could be used transform&lt;/P&gt;&lt;P&gt;{ "name" : "jon", "country" : "uk", "index" : "sit-event-2021-11-25" }&lt;/P&gt;&lt;P&gt;to&lt;/P&gt;&lt;P&gt;{"name" : "jon", "country" : "uk", "sourcetype" : "sit-event" }&lt;/P&gt;&lt;P&gt;using a regex to map any index value starting with "sit-event" to sourcetype "sit-event".&lt;/P&gt;&lt;P&gt;Alternatively this could be done on the instance if running Splunk Enterprise.&lt;/P&gt;&lt;P&gt;Have I understood this correctly?&lt;/P&gt;</description>
      <pubDate>Thu, 25 Nov 2021 14:22:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-transform-raw-JSON-with-field-called-index/m-p/576331#M101842</guid>
      <dc:creator>jon_radford</dc:creator>
      <dc:date>2021-11-25T14:22:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to transform raw JSON with field called 'index'</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-transform-raw-JSON-with-field-called-index/m-p/576333#M101843</link>
      <description>&lt;P&gt;You apply the transforms on the first "heavy" component that your data stream encounters. So if you have UF writing directly to indexer(s), you need to set the transform on indexer(s) but if you have more complicated environment like UF -&amp;gt; HF1 -&amp;gt;HF2 -&amp;gt; idx, you need to set it on first HF.&lt;/P&gt;&lt;P&gt;Oh, end you don't rewrite the data within the event itself, but in the event's metadata. Raw event stays as it was.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Nov 2021 14:29:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-transform-raw-JSON-with-field-called-index/m-p/576333#M101843</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2021-11-25T14:29:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to transform raw JSON with field called 'index'</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-transform-raw-JSON-with-field-called-index/m-p/576335#M101844</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231884"&gt;@PickleRick&lt;/a&gt;&amp;nbsp;, will pass this solution onto our Splunk team to see if they can implement it as you described&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Nov 2021 14:41:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-transform-raw-JSON-with-field-called-index/m-p/576335#M101844</guid>
      <dc:creator>jon_radford</dc:creator>
      <dc:date>2021-11-25T14:41:37Z</dc:date>
    </item>
  </channel>
</rss>

