<?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: Bulk rename fields created by spath in json search results in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Bulk-rename-fields-created-by-spath-in-json-search-results/m-p/184364#M36917</link>
    <description>&lt;P&gt;The field extractions are sourcetype specific. I don't think its possible to save for a saved search. There is a work around that you can try though. For each saved search, you can create a search macro which basically execute 'rex' command to extract field and then use the macro in the saved search. This way only the fields extraction defined in a macro will be shown.&lt;/P&gt;</description>
    <pubDate>Fri, 30 May 2014 18:29:15 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2014-05-30T18:29:15Z</dc:date>
    <item>
      <title>Bulk rename fields created by spath in json search results</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Bulk-rename-fields-created-by-spath-in-json-search-results/m-p/184361#M36914</link>
      <description>&lt;P&gt;I am working with a bunch of different logs that contain json, sometimes for events that differ.  I have the props set up so I can easily spath what I want. However even though the json is valid the structure is a bit messy and not consistent.  Until we clear up the json logging, I wanted to be able to do my searches with what I have and bulk rename the fields returned. I can't find an easy way to do this that is, on-the-fly, customizable.  Here is an example search and what I want to do.&lt;/P&gt;

&lt;P&gt;I know I can do the following and get rid of the data.subObject{} string portion in auto-field extraction&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;index=main sourcetype=jsonEvents&lt;BR /&gt;
|spath output=json path="data.subObject{}."&lt;BR /&gt;
|spath input=json &lt;BR /&gt;
|search *subObject* (this is to get specific events from the raw data)&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;But I would like to do this and just get rid of the data.subObject{} string in the field labels as there are many other json field extractions with different paths, but same subObject names.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;index=main sourcetype=jsonEvents&lt;BR /&gt;
|spath path="data.subObject{}."&lt;BR /&gt;
|search *subObject* (this is to get specific events from the raw data)&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Fields extracted here are :&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;data.subObject{}.a, data.subObject{}.b, data.subObject{}.c etc.&lt;/STRONG&gt; &lt;/P&gt;

&lt;P&gt;I want to rename them all to :&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;identifier.a, identifier.b, identifier.c etc.&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 30 May 2014 17:34:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Bulk-rename-fields-created-by-spath-in-json-search-results/m-p/184361#M36914</guid>
      <dc:creator>Cuyose</dc:creator>
      <dc:date>2014-05-30T17:34:08Z</dc:date>
    </item>
    <item>
      <title>Re: Bulk rename fields created by spath in json search results</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Bulk-rename-fields-created-by-spath-in-json-search-results/m-p/184362#M36915</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main sourcetype=jsonEvents |spath path="data.subObject{}." | rename "data.subObject{}."* as "identifier."*
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 30 May 2014 17:48:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Bulk-rename-fields-created-by-spath-in-json-search-results/m-p/184362#M36915</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-05-30T17:48:33Z</dc:date>
    </item>
    <item>
      <title>Re: Bulk rename fields created by spath in json search results</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Bulk-rename-fields-created-by-spath-in-json-search-results/m-p/184363#M36916</link>
      <description>&lt;P&gt;Thanks, this works for me! I was using rename after the fact.  I have another question waiting to be answered on how I can get field extractions saved on a per-search basis.&lt;/P&gt;

&lt;P&gt;The goal being so I don't have a list of hundreds of "selected fields" for all my different saved searches.&lt;/P&gt;</description>
      <pubDate>Fri, 30 May 2014 18:04:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Bulk-rename-fields-created-by-spath-in-json-search-results/m-p/184363#M36916</guid>
      <dc:creator>Cuyose</dc:creator>
      <dc:date>2014-05-30T18:04:03Z</dc:date>
    </item>
    <item>
      <title>Re: Bulk rename fields created by spath in json search results</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Bulk-rename-fields-created-by-spath-in-json-search-results/m-p/184364#M36917</link>
      <description>&lt;P&gt;The field extractions are sourcetype specific. I don't think its possible to save for a saved search. There is a work around that you can try though. For each saved search, you can create a search macro which basically execute 'rex' command to extract field and then use the macro in the saved search. This way only the fields extraction defined in a macro will be shown.&lt;/P&gt;</description>
      <pubDate>Fri, 30 May 2014 18:29:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Bulk-rename-fields-created-by-spath-in-json-search-results/m-p/184364#M36917</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-05-30T18:29:15Z</dc:date>
    </item>
    <item>
      <title>Re: Bulk rename fields created by spath in json search results</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Bulk-rename-fields-created-by-spath-in-json-search-results/m-p/184365#M36918</link>
      <description>&lt;P&gt;This made my life easier in picking out relevant fields.  Renaming the redundant fields to ZZZ, throws them at the end of the list, leaving only the extractions I targeted.&lt;/P&gt;

&lt;P&gt;index=main sourcetype=jsonLog&lt;BR /&gt;
|spath path="data.order."&lt;BR /&gt;
|search NOT *string* &lt;BR /&gt;
|rename "data.order.orderJSON.order_items{}."* as "items."*&lt;BR /&gt;
|rename "data.order."* as "order."*&lt;BR /&gt;
|rename "order.items{}."* as "ZZZ."*&lt;BR /&gt;
|rename "order.orderJSON."* as "ZZZ."*&lt;/P&gt;</description>
      <pubDate>Fri, 30 May 2014 18:56:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Bulk-rename-fields-created-by-spath-in-json-search-results/m-p/184365#M36918</guid>
      <dc:creator>Cuyose</dc:creator>
      <dc:date>2014-05-30T18:56:19Z</dc:date>
    </item>
    <item>
      <title>Re: Bulk rename fields created by spath in json search results</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Bulk-rename-fields-created-by-spath-in-json-search-results/m-p/184366#M36919</link>
      <description>&lt;P&gt;Bumping this topic: is there any way to do this in props?  I keep finding json logs with preposterously long paths to the fields; it would be good to have a quick way to permanently clean this up in one spot.&lt;/P&gt;</description>
      <pubDate>Sun, 29 Nov 2015 03:30:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Bulk-rename-fields-created-by-spath-in-json-search-results/m-p/184366#M36919</guid>
      <dc:creator>cmeo</dc:creator>
      <dc:date>2015-11-29T03:30:33Z</dc:date>
    </item>
  </channel>
</rss>

