<?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 to extract values from a field instead of _raw? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-values-from-a-field-instead-of-raw/m-p/353769#M104702</link>
    <description>&lt;P&gt;I don't understand your examples, but there are at least 2 ways to extract new fields from existing fields in props/transforms.  Let's say you have already extracted a field called "my_field".  &lt;/P&gt;

&lt;P&gt;Then using EXTRACT in props, you can tell splunk the field to run the regex against by adding " in myfield" after your regex.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;props&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[your_sourcetype]
EXTRACT-some_new_field = &amp;lt;your regex&amp;gt; in my_field
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or if you're using props/transforms, then specify the existing field as the source key in transforms&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;props&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[your_sourcetype]
REPORT-some_new_field = extract_new_field
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;transforms&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[extract_new_field]
SOURCE_KEY = my_field
REGEX = &amp;lt;your regex&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 25 Apr 2018 01:49:14 GMT</pubDate>
    <dc:creator>maciep</dc:creator>
    <dc:date>2018-04-25T01:49:14Z</dc:date>
    <item>
      <title>How to extract values from a field instead of _raw?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-values-from-a-field-instead-of-raw/m-p/353767#M104700</link>
      <description>&lt;P&gt;Hi &lt;/P&gt;

&lt;P&gt;I am getting below log and want to extract the data/values from the field using props.conf / transforms.conf.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Field_name:  [
  "value", "value", "value", "value"
]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In _raw format I'm getting the below logs from the same&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"Field_name": "[\r\n  \"value\",\r\n  \"value\",\r\n  \"value\",\r\n  \"value\"]"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Any help will be much appreciated. &lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 24 Apr 2018 09:40:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-values-from-a-field-instead-of-raw/m-p/353767#M104700</guid>
      <dc:creator>soumyacharya91</dc:creator>
      <dc:date>2018-04-24T09:40:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract values from a field instead of _raw?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-values-from-a-field-instead-of-raw/m-p/353768#M104701</link>
      <description>&lt;P&gt;Can you share whole event? Also what rex your using? You can use &lt;CODE&gt;| rex field=&amp;lt;field_name&amp;gt; max_match=0 "reg_exp"&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Apr 2018 13:53:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-values-from-a-field-instead-of-raw/m-p/353768#M104701</guid>
      <dc:creator>p_gurav</dc:creator>
      <dc:date>2018-04-24T13:53:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract values from a field instead of _raw?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-values-from-a-field-instead-of-raw/m-p/353769#M104702</link>
      <description>&lt;P&gt;I don't understand your examples, but there are at least 2 ways to extract new fields from existing fields in props/transforms.  Let's say you have already extracted a field called "my_field".  &lt;/P&gt;

&lt;P&gt;Then using EXTRACT in props, you can tell splunk the field to run the regex against by adding " in myfield" after your regex.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;props&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[your_sourcetype]
EXTRACT-some_new_field = &amp;lt;your regex&amp;gt; in my_field
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or if you're using props/transforms, then specify the existing field as the source key in transforms&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;props&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[your_sourcetype]
REPORT-some_new_field = extract_new_field
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;transforms&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[extract_new_field]
SOURCE_KEY = my_field
REGEX = &amp;lt;your regex&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 25 Apr 2018 01:49:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-values-from-a-field-instead-of-raw/m-p/353769#M104702</guid>
      <dc:creator>maciep</dc:creator>
      <dc:date>2018-04-25T01:49:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract values from a field instead of _raw?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-values-from-a-field-instead-of-raw/m-p/353770#M104703</link>
      <description>&lt;P&gt;Hi I have tried the solution using props.conf and transforms.conf &lt;/P&gt;

&lt;P&gt;Seems it is working properly when I search using &lt;STRONG&gt;extract reload=t&lt;/STRONG&gt;. But without this command in search query it is not working.&lt;/P&gt;

&lt;H1&gt;Transforms.conf&lt;/H1&gt;

&lt;P&gt;[name]&lt;BR /&gt;
SOURCE_KEY=&lt;BR /&gt;
REGEX =\"(?[^\s]+)\"&lt;/P&gt;

&lt;H1&gt;props.conf&lt;/H1&gt;

&lt;P&gt;REPORT-classname=name&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 08:56:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-values-from-a-field-instead-of-raw/m-p/353770#M104703</guid>
      <dc:creator>soumyacharya91</dc:creator>
      <dc:date>2018-04-25T08:56:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract values from a field instead of _raw?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-values-from-a-field-instead-of-raw/m-p/353771#M104704</link>
      <description>&lt;P&gt;that doesn't make any sense.  that extract command should force it to reload the config, which it will do on its own on some interval as well.  that shouldn't make it work or not work on a consistent basis.&lt;/P&gt;

&lt;P&gt;but i thought you said you were trying to extract a field from a field other than raw.  But you leave SOURCE_KEY blank above?  put the existing field in there instead of leaving it blank, so your regex runs against it instead of _raw.&lt;/P&gt;

&lt;P&gt;Also, please use the code button when posting your config data.  As you can see, answers is stripped out important characters from your comment.  &lt;/P&gt;

&lt;P&gt;with the code button:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;\"(?&amp;lt;some_field&amp;gt;[^\s]+)\"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;w/o code button:&lt;BR /&gt;
\"(?[^\s]+)\"&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 10:35:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-values-from-a-field-instead-of-raw/m-p/353771#M104704</guid>
      <dc:creator>maciep</dc:creator>
      <dc:date>2018-04-25T10:35:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract values from a field instead of _raw?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-values-from-a-field-instead-of-raw/m-p/353772#M104705</link>
      <description>&lt;P&gt;Actually I provided the field but some how it is not updated here. let me explain you the scenario clearly.&lt;/P&gt;

&lt;H1&gt;_raw data&lt;/H1&gt;

&lt;PRE&gt;&lt;CODE&gt;"Metadata": "{\r\n  \"GeneratedOnHost\": \"XXXXXX\"\r\n}"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;H1&gt;As syntax highlight&lt;/H1&gt;

&lt;PRE&gt;&lt;CODE&gt;Metadata:    {
  "GeneratedOnHost": "XXXXXX"
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;H2&gt;transforms.conf&lt;/H2&gt;

&lt;PRE&gt;&lt;CODE&gt;[name]
SOURCE_KEY=Metadata
REGEX =\"GeneratedOnHost\"\:\s\"(?&amp;lt;extracted field name&amp;gt;[^\s]+)\"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;H2&gt;props.conf&lt;/H2&gt;

&lt;P&gt;REPORT-name1=name&lt;/P&gt;

&lt;P&gt;I used this configuration which can able to extract if I include extract reload=t in my search query every time I execute. But without that command it can't even populating the extracted field name.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 10:57:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-values-from-a-field-instead-of-raw/m-p/353772#M104705</guid>
      <dc:creator>soumyacharya91</dc:creator>
      <dc:date>2018-04-25T10:57:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract values from a field instead of _raw?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-values-from-a-field-instead-of-raw/m-p/353773#M104706</link>
      <description>&lt;P&gt;I'm confused as to whether splunk is actually extracting the metadata field already or if you're just assuming because it's syntax-highlighted that it is?  You could extract that field yourself first if Splunk isn't doing it for you.&lt;/P&gt;

&lt;P&gt;also, are you in fast mode? if you're relying on splunk to extract the metadata field for you, then ensure you're allowing it do that by choosing smart or verbose mode.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 11:11:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-values-from-a-field-instead-of-raw/m-p/353773#M104706</guid>
      <dc:creator>maciep</dc:creator>
      <dc:date>2018-04-25T11:11:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract values from a field instead of _raw?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-values-from-a-field-instead-of-raw/m-p/353774#M104707</link>
      <description>&lt;P&gt;any update on this?  still not working?&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 22:02:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-values-from-a-field-instead-of-raw/m-p/353774#M104707</guid>
      <dc:creator>maciep</dc:creator>
      <dc:date>2018-04-25T22:02:32Z</dc:date>
    </item>
  </channel>
</rss>

