<?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: JSON transformations in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/JSON-transformations/m-p/370129#M67170</link>
    <description>&lt;PRE&gt;&lt;CODE&gt;I would do something like the following:
In your props.conf stanza defining sourcetype:
#This should everything up to and including the first "{" with a "{" - I think
SEDCMD=s/.+?{/{/  

In transforms, something like the following. This will extract key/value pairs at search time for you. Also, make sure to set time_format correctly.
[get_my_json_key_values]
REGEX="(.+?)"."(.+?)"
FORMAT=$1::$2
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 03 Jan 2018 00:02:27 GMT</pubDate>
    <dc:creator>sshelly_splunk</dc:creator>
    <dc:date>2018-01-03T00:02:27Z</dc:date>
    <item>
      <title>JSON transformations</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/JSON-transformations/m-p/370127#M67168</link>
      <description>&lt;P&gt;Hi. I have a problem with transformations in Splunk:&lt;/P&gt;

&lt;P&gt;Example event(small part of it):&lt;BR /&gt;
&lt;CODE&gt;Dec  1 22:29:42 127.0.0.1 1 2017-12-01 LOGSERVER 1292 - - {"event_type":"type_here","ipv4":"127.0.0.1","hostname":"pc_name.local","occured":"01-Dec-2017 22:24:34"}&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I need extract only json data:&lt;BR /&gt;
&lt;CODE&gt;{"event_type":"Threat_Event","ipv4":"127.0.0.1","hostname":"pc_name.local","occured":"01-Dec-2017 22:24:34","severity":"Warning","threat_type":"potentially unsafe application"}&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;and get fields from it.&lt;/P&gt;

&lt;P&gt;I'm found one solution: &lt;BR /&gt;
transforms.conf&lt;BR /&gt;
&lt;CODE&gt;[json_extract]&lt;BR /&gt;
SOURCE_KEY = _raw&lt;BR /&gt;
DEST_KEY = _raw&lt;BR /&gt;
REGEX = ^([^{]+)({.+})$&lt;BR /&gt;
FORMAT = $2&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;props.conf&lt;BR /&gt;
&lt;CODE&gt;[some_sourcetype]&lt;BR /&gt;
KV_MODE = json&lt;BR /&gt;
TRANSFORMS-jsonextraction = json_extract&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;It works! and all ok. But i need to do this using &lt;CODE&gt;Field Transformations&lt;/CODE&gt; in Splunk Web.&lt;/P&gt;

&lt;P&gt;When i'm doing this extractions in Splunk Web, i have problem with Format(more on the screenshot) &lt;BR /&gt;
Please, help me to do this using SplunkWeb.&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/4087iFDD43639C032EF3D/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2018 21:05:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/JSON-transformations/m-p/370127#M67168</guid>
      <dc:creator>jackson_storm</dc:creator>
      <dc:date>2018-01-02T21:05:29Z</dc:date>
    </item>
    <item>
      <title>Re: JSON transformations</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/JSON-transformations/m-p/370128#M67169</link>
      <description>&lt;P&gt;Are you having to use the UI to do this because it's Splunk Cloud?&lt;/P&gt;

&lt;P&gt;I've been unable to get this working without setting &lt;CODE&gt;DEST_KEY&lt;/CODE&gt; in transforms.conf, which isn't possible via the UI that I can tell, so you may not actually be able to accomplish this in Splunk Cloud (though I'm going to keep trying, or maybe someone else already knows how).&lt;/P&gt;

&lt;P&gt;If it's not Splunk Cloud, you may need to send your transforms/props to the admin to put in place.  Or, you could put said configurations in place via conf file on a heavy forwarder you maintain which sends the events to the indexers.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2018 23:34:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/JSON-transformations/m-p/370128#M67169</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2018-01-02T23:34:22Z</dc:date>
    </item>
    <item>
      <title>Re: JSON transformations</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/JSON-transformations/m-p/370129#M67170</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;I would do something like the following:
In your props.conf stanza defining sourcetype:
#This should everything up to and including the first "{" with a "{" - I think
SEDCMD=s/.+?{/{/  

In transforms, something like the following. This will extract key/value pairs at search time for you. Also, make sure to set time_format correctly.
[get_my_json_key_values]
REGEX="(.+?)"."(.+?)"
FORMAT=$1::$2
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 03 Jan 2018 00:02:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/JSON-transformations/m-p/370129#M67170</guid>
      <dc:creator>sshelly_splunk</dc:creator>
      <dc:date>2018-01-03T00:02:27Z</dc:date>
    </item>
    <item>
      <title>Re: JSON transformations</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/JSON-transformations/m-p/370130#M67171</link>
      <description>&lt;P&gt;I think the issue is finding a way to accomplish this in splunkweb, instead of directly in .conf files.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jan 2018 00:05:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/JSON-transformations/m-p/370130#M67171</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2018-01-03T00:05:31Z</dc:date>
    </item>
    <item>
      <title>Re: JSON transformations</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/JSON-transformations/m-p/370131#M67172</link>
      <description>&lt;P&gt;Yes. The issue is finding a way to accomplish this in splunkweb, instead of directly in .conf files. &lt;/P&gt;</description>
      <pubDate>Wed, 03 Jan 2018 10:06:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/JSON-transformations/m-p/370131#M67172</guid>
      <dc:creator>jackson_storm</dc:creator>
      <dc:date>2018-01-03T10:06:37Z</dc:date>
    </item>
    <item>
      <title>Re: JSON transformations</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/JSON-transformations/m-p/370132#M67173</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;    Sorry - a bit quick on the "submit" button:)
    In the UI, you can create the sourcetype. I used your single event, and this is what I came up with: 
Timestamp format %d-%b-%Y %H:%M:%S
Timestamp prefix occured":"
Under "Advanced" 
SEDCMD s/.+?{/{/
KV_MODE=json
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 03 Jan 2018 16:17:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/JSON-transformations/m-p/370132#M67173</guid>
      <dc:creator>sshelly_splunk</dc:creator>
      <dc:date>2018-01-03T16:17:11Z</dc:date>
    </item>
    <item>
      <title>Re: JSON transformations</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/JSON-transformations/m-p/370133#M67174</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;        Sorry - a bit quick on the "submit" button:)
        In the UI, you can create the sourcetype. I used your single event, and this is what I came up with: 
    Timestamp format %d-%b-%Y %H:%M:%S
    Timestamp prefix occured":"
    Under "Advanced" 
    SEDCMD s/.+?{/{/
    KV_MODE=json
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 03 Jan 2018 16:18:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/JSON-transformations/m-p/370133#M67174</guid>
      <dc:creator>sshelly_splunk</dc:creator>
      <dc:date>2018-01-03T16:18:01Z</dc:date>
    </item>
    <item>
      <title>Re: JSON transformations</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/JSON-transformations/m-p/370134#M67175</link>
      <description>&lt;P&gt;After some discussion, it is possible to configure &lt;CODE&gt;SEDCMD&lt;/CODE&gt; via the UI (but not &lt;CODE&gt;TRANSFORMS-&lt;/CODE&gt; that rewrite _raw).  To do so you can edit the sourcetype at:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;&amp;lt;your splunk url&amp;gt;/en-US/manager/launcher/sourcetypes#&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;The select your sourcetype, expand &lt;CODE&gt;Advanced&lt;/CODE&gt;, and add a line for &lt;CODE&gt;SEDCMD&lt;/CODE&gt; as previously discussed.  Attached is a screenshot of this configuration.&lt;/P&gt;

&lt;P&gt;Credit to @duckfez and @martin_mueller&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="screenshot showing Advanced settings, with SEDCMD"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/4086iEEE1351E3C41F227/image-size/large?v=v2&amp;amp;px=999" role="button" title="screenshot showing Advanced settings, with SEDCMD" alt="screenshot showing Advanced settings, with SEDCMD" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jan 2018 16:42:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/JSON-transformations/m-p/370134#M67175</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2018-01-03T16:42:30Z</dc:date>
    </item>
    <item>
      <title>Re: JSON transformations</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/JSON-transformations/m-p/370135#M67176</link>
      <description>&lt;P&gt;It works. Thank you&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jan 2018 10:29:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/JSON-transformations/m-p/370135#M67176</guid>
      <dc:creator>jackson_storm</dc:creator>
      <dc:date>2018-01-04T10:29:36Z</dc:date>
    </item>
  </channel>
</rss>

