<?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 Field Extraction problem in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-problem/m-p/108444#M28242</link>
    <description>&lt;P&gt;I am trying to extract some data from a script output.&lt;BR /&gt;
Sample:&lt;BR /&gt;
SERVICE_NAME: WebTrends - Data Retention Service&lt;BR /&gt;
DISPLAY_NAME: WebTrends - Data Retention Service&lt;BR /&gt;
        TYPE               : 10  WIN32_OWN_PROCESS&lt;BR /&gt;&lt;BR /&gt;
        STATE              : 1  STOPPED &lt;BR /&gt;
        WIN32_EXIT_CODE    : 0  (0x0)&lt;BR /&gt;
        SERVICE_EXIT_CODE  : 0  (0x0)&lt;BR /&gt;
        CHECKPOINT         : 0x0&lt;BR /&gt;
        WAIT_HINT          : 0x0&lt;BR /&gt;
I have checked successfully the Generated pattern (regex) with the Interactive Field Extractor  and also using a query.&lt;BR /&gt;
index=main sourcetype="services_monitoring_status" | head 10000 | rex "(?i)SERVICE_NAME: (?P&lt;FIELDNAME&gt;.+)"&lt;BR /&gt;
But curiously if I save this regex as a Field extraction doesn’t work…because not only take the name. It takes all the rest of the event, not break at the end of the line.&lt;BR /&gt;
Expected behavior:&lt;BR /&gt;
Namefield = WebTrends - Data Retention Service&lt;BR /&gt;
Incorrect behavior:&lt;BR /&gt;
Namefield= WebTrends - Data Retention Service DISPLAY_NAME: WebTrends - Data Retention Service       TYPE               : 10  WIN32_OWN_PROCESS          STATE              : 1  STOPPED         WIN32_EXIT_CODE    : 0  (0x0)        SERVICE_EXIT_CODE  : 0  (0x0)        CHECKPOINT         : 0x0        WAIT_HINT          : 0x0&lt;BR /&gt;
So How is possible this differents behavior doing the same?&lt;/FIELDNAME&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 10:05:10 GMT</pubDate>
    <dc:creator>bfernandez</dc:creator>
    <dc:date>2020-09-28T10:05:10Z</dc:date>
    <item>
      <title>Field Extraction problem</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-problem/m-p/108444#M28242</link>
      <description>&lt;P&gt;I am trying to extract some data from a script output.&lt;BR /&gt;
Sample:&lt;BR /&gt;
SERVICE_NAME: WebTrends - Data Retention Service&lt;BR /&gt;
DISPLAY_NAME: WebTrends - Data Retention Service&lt;BR /&gt;
        TYPE               : 10  WIN32_OWN_PROCESS&lt;BR /&gt;&lt;BR /&gt;
        STATE              : 1  STOPPED &lt;BR /&gt;
        WIN32_EXIT_CODE    : 0  (0x0)&lt;BR /&gt;
        SERVICE_EXIT_CODE  : 0  (0x0)&lt;BR /&gt;
        CHECKPOINT         : 0x0&lt;BR /&gt;
        WAIT_HINT          : 0x0&lt;BR /&gt;
I have checked successfully the Generated pattern (regex) with the Interactive Field Extractor  and also using a query.&lt;BR /&gt;
index=main sourcetype="services_monitoring_status" | head 10000 | rex "(?i)SERVICE_NAME: (?P&lt;FIELDNAME&gt;.+)"&lt;BR /&gt;
But curiously if I save this regex as a Field extraction doesn’t work…because not only take the name. It takes all the rest of the event, not break at the end of the line.&lt;BR /&gt;
Expected behavior:&lt;BR /&gt;
Namefield = WebTrends - Data Retention Service&lt;BR /&gt;
Incorrect behavior:&lt;BR /&gt;
Namefield= WebTrends - Data Retention Service DISPLAY_NAME: WebTrends - Data Retention Service       TYPE               : 10  WIN32_OWN_PROCESS          STATE              : 1  STOPPED         WIN32_EXIT_CODE    : 0  (0x0)        SERVICE_EXIT_CODE  : 0  (0x0)        CHECKPOINT         : 0x0        WAIT_HINT          : 0x0&lt;BR /&gt;
So How is possible this differents behavior doing the same?&lt;/FIELDNAME&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 10:05:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-problem/m-p/108444#M28242</guid>
      <dc:creator>bfernandez</dc:creator>
      <dc:date>2020-09-28T10:05:10Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction problem</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-problem/m-p/108445#M28243</link>
      <description>&lt;P&gt;try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex "(?i)SERVICE_NAME:\s+(?P&amp;lt;fieldname&amp;gt;.+)([\r\n\s]+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 11 Nov 2011 08:21:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-problem/m-p/108445#M28243</guid>
      <dc:creator>hjwang</dc:creator>
      <dc:date>2011-11-11T08:21:16Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction problem</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-problem/m-p/108446#M28244</link>
      <description>&lt;P&gt;This regex in a query works as well &lt;/P&gt;

&lt;P&gt;index=main sourcetype="services_monitoring_status" | head 10000 | rex "(?i)SERVICE_NAME:\s+(?P&lt;FIELDNAME&gt;.+)([\r\n\s]+)"&lt;/FIELDNAME&gt;&lt;/P&gt;

&lt;P&gt;But If I save it as a field extraction in the console, it returns the same wrong values…as mine&lt;/P&gt;

&lt;P&gt;(?i)SERVICE_NAME:\s+(?P&lt;FIELDNAME&gt;.+)([\r\n\s]+)&lt;/FIELDNAME&gt;&lt;/P&gt;

&lt;P&gt;Is strange that could returns different results depending on how you apply the regex.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 10:05:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-problem/m-p/108446#M28244</guid>
      <dc:creator>bfernandez</dc:creator>
      <dc:date>2020-09-28T10:05:31Z</dc:date>
    </item>
  </channel>
</rss>

