<?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 do I extract a value of a key from multi-format data? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-extract-a-value-of-a-key-from-multi-format-data/m-p/413306#M73101</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I'm new in Splunk. I need help with extraction data, and I have a multi-format file. Example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;08-Oct-2018 16:27:46.6300000|I|CompanyService|MsgReceivePooling OperationRequestMsg [Id(5976) .Net(14)]|App|Company|Algorithm|Treshold||{ "OperationRequestId" : "5", "StockId" : "value pallet", "msgContent" : "Test content" }
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;As you can see, there is part of this line which is in JSON format.&lt;/P&gt;

&lt;P&gt;My need is that I want to extract the value of key "msgContent"&lt;/P&gt;

&lt;P&gt;Anyone have an idea about how to do it?&lt;/P&gt;

&lt;P&gt;Thank you&lt;/P&gt;</description>
    <pubDate>Wed, 10 Oct 2018 10:25:52 GMT</pubDate>
    <dc:creator>issbouzidi</dc:creator>
    <dc:date>2018-10-10T10:25:52Z</dc:date>
    <item>
      <title>How do I extract a value of a key from multi-format data?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-extract-a-value-of-a-key-from-multi-format-data/m-p/413306#M73101</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I'm new in Splunk. I need help with extraction data, and I have a multi-format file. Example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;08-Oct-2018 16:27:46.6300000|I|CompanyService|MsgReceivePooling OperationRequestMsg [Id(5976) .Net(14)]|App|Company|Algorithm|Treshold||{ "OperationRequestId" : "5", "StockId" : "value pallet", "msgContent" : "Test content" }
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;As you can see, there is part of this line which is in JSON format.&lt;/P&gt;

&lt;P&gt;My need is that I want to extract the value of key "msgContent"&lt;/P&gt;

&lt;P&gt;Anyone have an idea about how to do it?&lt;/P&gt;

&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Wed, 10 Oct 2018 10:25:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-extract-a-value-of-a-key-from-multi-format-data/m-p/413306#M73101</guid>
      <dc:creator>issbouzidi</dc:creator>
      <dc:date>2018-10-10T10:25:52Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract a value of a key from multi-format data?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-extract-a-value-of-a-key-from-multi-format-data/m-p/413307#M73102</link>
      <description>&lt;P&gt;try regex to extract msgContent-&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|rex "msgContent\"\s:\s\"(?&amp;lt;msgContent&amp;gt;[^\"]+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;try this run anywhere search-&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults|eval _raw="08-Oct-2018 16:27:46.6300000|I|CompanyService|MsgReceivePooling OperationRequestMsg [Id(5976) .Net(14)]|App|Company|Algorithm|Treshold||{ \"OperationRequestId\" : \"5\", \"StockId\" : \"value pallet\", \"msgContent\" : \"Test content\" }"|rex "msgContent\"\s:\s\"(?&amp;lt;msgContent&amp;gt;[^\"]+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Oct 2018 13:02:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-extract-a-value-of-a-key-from-multi-format-data/m-p/413307#M73102</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-10-10T13:02:54Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract a value of a key from multi-format data?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-extract-a-value-of-a-key-from-multi-format-data/m-p/413308#M73103</link>
      <description>&lt;P&gt;thank a lot @493669 , the regex works good &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Oct 2018 14:02:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-extract-a-value-of-a-key-from-multi-format-data/m-p/413308#M73103</guid>
      <dc:creator>issbouzidi</dc:creator>
      <dc:date>2018-10-10T14:02:36Z</dc:date>
    </item>
  </channel>
</rss>

