<?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: Problem parsing fields with spaces at index time for metrics in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-fields-with-spaces-at-index-time-for-metrics/m-p/383936#M112137</link>
    <description>&lt;P&gt;I can PROVE that this works.  Run this search and look at the results:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw="Date=2019-02-15_00:06:04_+0000,collection=Available Memory,object=Memory,counter=Available Bytes,metric_name=available_bytes,instance=0,Value=5155557376" 
| rex max_match=0 ",(?&amp;lt;key&amp;gt;[^=]+)\s*=\s*(?&amp;lt;value&amp;gt;[^,]+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So, why might this not be working?  Did you:&lt;BR /&gt;
Use the ORIGINAL sourcetype value in your stanza header if you are doing sourcetype override/overwrite?&lt;BR /&gt;
Deploy to the first full instance of Splunk that handles these events (HF or Indexers)?&lt;BR /&gt;
Restart all splunk instances there.&lt;BR /&gt;
Send fresh data in after the restarts.&lt;BR /&gt;
Test with a search using a &lt;CODE&gt;Time picker&lt;/CODE&gt; value of &lt;CODE&gt;All time&lt;/CODE&gt; and SPL like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=* sourcetype=YourOriginalSourcetypeHere _index_earliest=-5m
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 08 Mar 2019 03:31:41 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2019-03-08T03:31:41Z</dc:date>
    <item>
      <title>How to parse fields with spaces at index time for metrics?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-fields-with-spaces-at-index-time-for-metrics/m-p/383931#M112132</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;
&lt;P&gt;I am currently having some problems with filtering my raw data into a metric index. My raw data currently looks like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;Date=2019-02-15_00:06:04_+0000,collection=Available Memory,object=Memory,counter=Available Bytes,metric_name=available_bytes,instance=0,Value=5155557376
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;my main issue is with the 'counter' and 'collection' fields which have values that contain spaces. e.g. Available Bytes.&lt;/P&gt;
&lt;P&gt;I initially was using the field_extraction TRANSFORM in order to parse the data. Here are the relevant stanzas from my props.conf and transforms.conf here:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;props.conf:

[mkv:meminfo:Memory]
TRANSFORMS-EXTRACT = field_extraction
METRIC-SCHEMA-TRANSFORMS = metric-schema:extract_metrics
category = Log to Metrics

transforms.conf:

[metric-schema:extract_metrics]
METRIC-SCHEMA-MEASURES = Value
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;BUT this only seemed to take the first word of the phrase. e.g. in splunk, counter would only be 'Available' (see image below)&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline"&gt;&lt;img src="https://community.splunk.com/skins/images/2D7C0329EFD3226A3A0539BD67E34BAF/responsive_peak/images/image_not_found.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I then tried to manually extract the field using REGEX through the config files. This is what my transforms.conf and props.conf look like at this point:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;Data:
Date=2019-02-15_00:06:04_+0000,collection=Available Memory,object=Memory,counter=Available Bytes,metric_name=available_bytes,instance=0,Value=5155557376

props.conf:

[mkv:meminfo:Memory]
TRANSFORMS-metricsfields = custom_field_extractor
METRIC-SCHEMA-TRANSFORMS = metric-schema:extract_metrics
category = Log to Metrics

transforms.conf:

[custom_field_extractor]
REGEX = ([a-zA-Z]+)=([^,]*)
FORMAT = $1::$2
WRITE_META = true
REPEAT_MATCH = true

[metric-schema:extract_metrics]
METRIC-SCHEMA-MEASURES = Value
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This produces the same results, the counter and collection values are still only 'Available'.&lt;BR /&gt;Can anybody see a problem with the strategy that i'm implementing?&lt;/P&gt;
&lt;P&gt;NOTE: have also added stanza to fields.conf although not sure if it's doing anything:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;[metricsfields]
INDEXED=true
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 14 Sep 2023 16:30:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-parse-fields-with-spaces-at-index-time-for-metrics/m-p/383931#M112132</guid>
      <dc:creator>tlscelsi</dc:creator>
      <dc:date>2023-09-14T16:30:13Z</dc:date>
    </item>
    <item>
      <title>Re: Problem parsing fields with spaces at index time for metrics</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-fields-with-spaces-at-index-time-for-metrics/m-p/383932#M112133</link>
      <description>&lt;P&gt;Keep everything the same but change this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;REGEX = ,([^=]+)\s*=\s*([^,]+)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 15 Feb 2019 02:12:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-parse-fields-with-spaces-at-index-time-for-metrics/m-p/383932#M112133</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-02-15T02:12:23Z</dc:date>
    </item>
    <item>
      <title>Re: Problem parsing fields with spaces at index time for metrics</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-fields-with-spaces-at-index-time-for-metrics/m-p/383933#M112134</link>
      <description>&lt;P&gt;Hey Gregg, &lt;/P&gt;

&lt;P&gt;Made the REGEX change you suggested and when i restarted splunk gave me this error:&lt;BR /&gt;
    Bad regex value: ',([^=]+)\s*=\s*(?[^,]+)', of param: transforms.conf / [custom_field_extractor] / REGEX; why: unrecognized character after (? or (?-&lt;BR /&gt;
            One or more regexes in your configuration are not valid. For details, please see btool.log or directly above.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 23:14:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-parse-fields-with-spaces-at-index-time-for-metrics/m-p/383933#M112134</guid>
      <dc:creator>tlscelsi</dc:creator>
      <dc:date>2020-09-29T23:14:34Z</dc:date>
    </item>
    <item>
      <title>Re: Problem parsing fields with spaces at index time for metrics</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-fields-with-spaces-at-index-time-for-metrics/m-p/383934#M112135</link>
      <description>&lt;P&gt;I blew it and left a stray &lt;CODE&gt;?&lt;/CODE&gt; in there.  I edited my original answer and fixed it.  Try it now.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Feb 2019 06:20:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-parse-fields-with-spaces-at-index-time-for-metrics/m-p/383934#M112135</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-02-15T06:20:01Z</dc:date>
    </item>
    <item>
      <title>Re: Problem parsing fields with spaces at index time for metrics</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-fields-with-spaces-at-index-time-for-metrics/m-p/383935#M112136</link>
      <description>&lt;P&gt;Hey Gregg, still doesn't seem to be working &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; am still only seeing 'Available' instead of 'Available Bytes'. Could this be some sort of splunk bug?&lt;/P&gt;</description>
      <pubDate>Sun, 17 Feb 2019 23:02:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-parse-fields-with-spaces-at-index-time-for-metrics/m-p/383935#M112136</guid>
      <dc:creator>tlscelsi</dc:creator>
      <dc:date>2019-02-17T23:02:25Z</dc:date>
    </item>
    <item>
      <title>Re: Problem parsing fields with spaces at index time for metrics</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-fields-with-spaces-at-index-time-for-metrics/m-p/383936#M112137</link>
      <description>&lt;P&gt;I can PROVE that this works.  Run this search and look at the results:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw="Date=2019-02-15_00:06:04_+0000,collection=Available Memory,object=Memory,counter=Available Bytes,metric_name=available_bytes,instance=0,Value=5155557376" 
| rex max_match=0 ",(?&amp;lt;key&amp;gt;[^=]+)\s*=\s*(?&amp;lt;value&amp;gt;[^,]+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So, why might this not be working?  Did you:&lt;BR /&gt;
Use the ORIGINAL sourcetype value in your stanza header if you are doing sourcetype override/overwrite?&lt;BR /&gt;
Deploy to the first full instance of Splunk that handles these events (HF or Indexers)?&lt;BR /&gt;
Restart all splunk instances there.&lt;BR /&gt;
Send fresh data in after the restarts.&lt;BR /&gt;
Test with a search using a &lt;CODE&gt;Time picker&lt;/CODE&gt; value of &lt;CODE&gt;All time&lt;/CODE&gt; and SPL like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=* sourcetype=YourOriginalSourcetypeHere _index_earliest=-5m
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 08 Mar 2019 03:31:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-parse-fields-with-spaces-at-index-time-for-metrics/m-p/383936#M112137</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-03-08T03:31:41Z</dc:date>
    </item>
    <item>
      <title>Re: Problem parsing fields with spaces at index time for metrics</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-fields-with-spaces-at-index-time-for-metrics/m-p/657368#M227060</link>
      <description>&lt;P&gt;Indexed fields cannot span major segments.&amp;nbsp; Space " " breaks the value into multiple major segments.&amp;nbsp; The value to be indexed must not contain major index breakers like space " ".&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2023 21:26:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-parse-fields-with-spaces-at-index-time-for-metrics/m-p/657368#M227060</guid>
      <dc:creator>landen99_gdms</dc:creator>
      <dc:date>2023-09-12T21:26:10Z</dc:date>
    </item>
  </channel>
</rss>

