<?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 rename a JSON field by editing a configuration file (NOT when running search)? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-rename-a-JSON-field-by-editing-a-configuration-file-NOT/m-p/367210#M66754</link>
    <description>&lt;P&gt;There is a log source that publishes events in JSON format, but the field name is in 3-digit numbers, not in English, like below:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{"xyzEvent" : {111 : "2017-03-20 02:58:02.000",222 : "New", 333 : "Alex Bob"}}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I wanted to rename those field names when the events arrive, not when support users search in the application.&lt;BR /&gt;
For example, I wanted to rename 111 to "TimeStamp"; 222 to "EventType"; 333 to "User", etc.&lt;BR /&gt;
Could you advise the easiest way to do so?&lt;/P&gt;

&lt;P&gt;Ways I have tried:&lt;BR /&gt;
I was thinking to config the search props.conf to specific those fields, but it seems I can only config based on regex. It does not seem to be an efficient way...&lt;/P&gt;</description>
    <pubDate>Mon, 20 Mar 2017 05:06:27 GMT</pubDate>
    <dc:creator>leonjxtan</dc:creator>
    <dc:date>2017-03-20T05:06:27Z</dc:date>
    <item>
      <title>How to rename a JSON field by editing a configuration file (NOT when running search)?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-rename-a-JSON-field-by-editing-a-configuration-file-NOT/m-p/367210#M66754</link>
      <description>&lt;P&gt;There is a log source that publishes events in JSON format, but the field name is in 3-digit numbers, not in English, like below:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{"xyzEvent" : {111 : "2017-03-20 02:58:02.000",222 : "New", 333 : "Alex Bob"}}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I wanted to rename those field names when the events arrive, not when support users search in the application.&lt;BR /&gt;
For example, I wanted to rename 111 to "TimeStamp"; 222 to "EventType"; 333 to "User", etc.&lt;BR /&gt;
Could you advise the easiest way to do so?&lt;/P&gt;

&lt;P&gt;Ways I have tried:&lt;BR /&gt;
I was thinking to config the search props.conf to specific those fields, but it seems I can only config based on regex. It does not seem to be an efficient way...&lt;/P&gt;</description>
      <pubDate>Mon, 20 Mar 2017 05:06:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-rename-a-JSON-field-by-editing-a-configuration-file-NOT/m-p/367210#M66754</guid>
      <dc:creator>leonjxtan</dc:creator>
      <dc:date>2017-03-20T05:06:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to rename a JSON field by editing a configuration file (NOT when running search)?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-rename-a-JSON-field-by-editing-a-configuration-file-NOT/m-p/367211#M66755</link>
      <description>&lt;P&gt;You can create &lt;STRONG&gt;field alias&lt;/STRONG&gt; knowledge object.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Mar 2017 07:48:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-rename-a-JSON-field-by-editing-a-configuration-file-NOT/m-p/367211#M66755</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-03-20T07:48:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to rename a JSON field by editing a configuration file (NOT when running search)?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-rename-a-JSON-field-by-editing-a-configuration-file-NOT/m-p/367212#M66756</link>
      <description>&lt;P&gt;As @niketnilay is saying in a comment in question, you can use props.conf's FIELDALIAS attribute. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;FIELDALIAS-alias01 = xyzEvent.111 AS TimeStamp
FIELDALIAS-alias02 = xyzEvent.222 AS EventType
FIELDALIAS-alias03 = xyzEvent.333 AS User
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;One thing is that 111,  222, 333 require double-quotes as strings. &lt;BR /&gt;
If they do not have double-quotes, Splunk will not be able to take the event as json format, and auto-KV extraction will not extract field 111, 222, 333. &lt;/P&gt;

&lt;P&gt;Please double-check the events using a Json validator available in Internet.  &lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2017 00:18:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-rename-a-JSON-field-by-editing-a-configuration-file-NOT/m-p/367212#M66756</guid>
      <dc:creator>Masa</dc:creator>
      <dc:date>2017-03-21T00:18:35Z</dc:date>
    </item>
  </channel>
</rss>

