<?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: How do I extract a field from the _raw data in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/How-do-I-extract-a-field-from-the-raw-data/m-p/432674#M7764</link>
    <description>&lt;P&gt;If your problem is resolved, please accept the answer to help future readers.&lt;/P&gt;</description>
    <pubDate>Thu, 31 May 2018 15:48:56 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2018-05-31T15:48:56Z</dc:date>
    <item>
      <title>How do I extract a field from the _raw data</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-do-I-extract-a-field-from-the-raw-data/m-p/432669#M7759</link>
      <description>&lt;P&gt;Hi guys,&lt;/P&gt;

&lt;P&gt;Tried my best googling an answer but have not been able to find something that fits my requirement.&lt;/P&gt;

&lt;P&gt;I have the following raw_data:&lt;/P&gt;

&lt;P&gt;... \"number_of_goods\":10,\"number_of_locations\":5, ...&lt;/P&gt;

&lt;P&gt;How do I create a field called number_of_goods and number_of_locations where the value is 10 and 5?&lt;/P&gt;

&lt;P&gt;Many thanks in advance!&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 19:47:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-do-I-extract-a-field-from-the-raw-data/m-p/432669#M7759</guid>
      <dc:creator>danielsan</dc:creator>
      <dc:date>2020-09-29T19:47:34Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract a field from the _raw data</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-do-I-extract-a-field-from-the-raw-data/m-p/432670#M7760</link>
      <description>&lt;P&gt;Try the &lt;CODE&gt;rex&lt;/CODE&gt; command.  The backslashes are needed to escape the backslashes and quotes in your data.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;your search&amp;gt; | rex "number_of_goods\\\\\":(?&amp;lt;numberOfGoods&amp;gt;\d+),\\\\\"number_of_locations\\\\\":(?&amp;lt;numberOfLocations&amp;gt;\d+)" | ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 31 May 2018 12:48:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-do-I-extract-a-field-from-the-raw-data/m-p/432670#M7760</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2018-05-31T12:48:43Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract a field from the _raw data</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-do-I-extract-a-field-from-the-raw-data/m-p/432671#M7761</link>
      <description>&lt;P&gt;I guess you could also avoid having to mess with those backslashes and escaped quotes, by doing:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "number_of_goods[^:]+:(?&amp;lt;numberOfGoods&amp;gt;\d+),[^\w]+number_of_locations[^:]+:(?&amp;lt;numberOfLocations&amp;gt;\d+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;A href="https://regex101.com/r/RgxoTh/1"&gt;https://regex101.com/r/RgxoTh/1&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 31 May 2018 13:23:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-do-I-extract-a-field-from-the-raw-data/m-p/432671#M7761</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2018-05-31T13:23:13Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract a field from the _raw data</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-do-I-extract-a-field-from-the-raw-data/m-p/432672#M7762</link>
      <description>&lt;P&gt;It works, you really saved my day. I have one follow-up question though. I'm trying to extract a similar field but it has a decimal value, e.g. 0.25 and with the rex example I got from you, I only get the first digit before the decimal and I can't figure out how to get the full value.&lt;/P&gt;</description>
      <pubDate>Thu, 31 May 2018 13:29:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-do-I-extract-a-field-from-the-raw-data/m-p/432672#M7762</guid>
      <dc:creator>danielsan</dc:creator>
      <dc:date>2018-05-31T13:29:35Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract a field from the _raw data</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-do-I-extract-a-field-from-the-raw-data/m-p/432673#M7763</link>
      <description>&lt;P&gt;The regex for a floating point number is &lt;CODE&gt;\d+\.\d+&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 31 May 2018 15:46:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-do-I-extract-a-field-from-the-raw-data/m-p/432673#M7763</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2018-05-31T15:46:09Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract a field from the _raw data</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-do-I-extract-a-field-from-the-raw-data/m-p/432674#M7764</link>
      <description>&lt;P&gt;If your problem is resolved, please accept the answer to help future readers.&lt;/P&gt;</description>
      <pubDate>Thu, 31 May 2018 15:48:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-do-I-extract-a-field-from-the-raw-data/m-p/432674#M7764</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2018-05-31T15:48:56Z</dc:date>
    </item>
  </channel>
</rss>

