<?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: Why am I unable to extract event values using REGEX and FORMAT in transforms.conf and REPORT in props.conf? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-extract-event-values-using-REGEX-and-FORMAT/m-p/164863#M46823</link>
    <description>&lt;P&gt;Since it is multiline, try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;REGEX = (?m)\s*(\d+)\s+(\d+)\s+(\d+)
FORMAT = totThreads::$1 runThreads::$2 slpThreads::$3
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 12 Aug 2015 13:27:31 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2015-08-12T13:27:31Z</dc:date>
    <item>
      <title>Why am I unable to extract event values using REGEX and FORMAT in transforms.conf and REPORT in props.conf?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-extract-event-values-using-REGEX-and-FORMAT/m-p/164858#M46818</link>
      <description>&lt;P&gt;Hi &lt;/P&gt;

&lt;P&gt;I have created a shell script (script input) which is attached. It gives me information about status of threads in Linux.&lt;/P&gt;

&lt;P&gt;Sample output of the script is as below:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;totThreads      runThreads      slpThreads
       433               2             431
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now I want extract fields from these events.&lt;/P&gt;

&lt;P&gt;In transforms.conf: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[fields_for_threads_sh]
REGEX = \s+([0-9.?]+)\s+([0-9.?]+)\s+([0-9.?]+)
FORMAT = totThreads::"$1" runThreads::"$2" slpThreads::"$3"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In props.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[threads]
LINE_BREAKER=(^$|[\r\n]+[\r\n]+)
TRUNCATE=1000000
DATETIME_CONFIG = CURRENT

REPORT-0kv_for_threads = fields_for_threads_sh
FIELDALIAS-system_threads_count_for_threads = totThreads as system_threads_count
FIELDALIAS-sleeping_threads_count_for_threads = slpThreads as wait_threads_count
FIELDALIAS-running_threads_count_for_threads = runThreads as running_threads_count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now when all this is configured, my events are generated with all three values as 0.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;totThreads  runThreads  slpThreads
         0           0           0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please help where I am going wrong?&lt;/P&gt;</description>
      <pubDate>Mon, 10 Aug 2015 12:42:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-extract-event-values-using-REGEX-and-FORMAT/m-p/164858#M46818</guid>
      <dc:creator>ishangajera</dc:creator>
      <dc:date>2015-08-10T12:42:54Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I unable to extract event values using REGEX and FORMAT in transforms.conf and REPORT in props.conf?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-extract-event-values-using-REGEX-and-FORMAT/m-p/164859#M46819</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;REGEX = \s*(\d+)\s+(\d+)\s+(\d+)
FORMAT = totThreads::$1 runThreads::$2 slpThreads::$3
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 10 Aug 2015 17:30:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-extract-event-values-using-REGEX-and-FORMAT/m-p/164859#M46819</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-08-10T17:30:48Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I unable to extract event values using REGEX and FORMAT in transforms.conf and REPORT in props.conf?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-extract-event-values-using-REGEX-and-FORMAT/m-p/164860#M46820</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Tried changing REGEX and FORMAT as you specified. But still no change. The values are still 0.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Aug 2015 04:30:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-extract-event-values-using-REGEX-and-FORMAT/m-p/164860#M46820</guid>
      <dc:creator>ishangajera</dc:creator>
      <dc:date>2015-08-11T04:30:10Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I unable to extract event values using REGEX and FORMAT in transforms.conf and REPORT in props.conf?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-extract-event-values-using-REGEX-and-FORMAT/m-p/164861#M46821</link>
      <description>&lt;P&gt;I don't understand.  The configurations we are talking about have NOTHING to do with the data inside the raw events (they can never "case" anything to become "0").  What does this show?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | table _raw totThreads runThreads slpThreads
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 11 Aug 2015 14:10:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-extract-event-values-using-REGEX-and-FORMAT/m-p/164861#M46821</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-08-11T14:10:14Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I unable to extract event values using REGEX and FORMAT in transforms.conf and REPORT in props.conf?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-extract-event-values-using-REGEX-and-FORMAT/m-p/164862#M46822</link>
      <description>&lt;P&gt;Hi &lt;BR /&gt;
Please check the output as shown in image:&lt;/P&gt;

&lt;P&gt;&lt;IMG src="http://s22.postimg.org/czxhe8l69/Capture.png" alt="alt text" /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Aug 2015 04:38:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-extract-event-values-using-REGEX-and-FORMAT/m-p/164862#M46822</guid>
      <dc:creator>ishangajera</dc:creator>
      <dc:date>2015-08-12T04:38:11Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I unable to extract event values using REGEX and FORMAT in transforms.conf and REPORT in props.conf?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-extract-event-values-using-REGEX-and-FORMAT/m-p/164863#M46823</link>
      <description>&lt;P&gt;Since it is multiline, try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;REGEX = (?m)\s*(\d+)\s+(\d+)\s+(\d+)
FORMAT = totThreads::$1 runThreads::$2 slpThreads::$3
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Aug 2015 13:27:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-extract-event-values-using-REGEX-and-FORMAT/m-p/164863#M46823</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-08-12T13:27:31Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I unable to extract event values using REGEX and FORMAT in transforms.conf and REPORT in props.conf?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-extract-event-values-using-REGEX-and-FORMAT/m-p/164864#M46824</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;It is still not working. I have another configuration for another field in the app. &lt;BR /&gt;
That is also multiline event. But for that we are getting the data in events. &lt;/P&gt;

&lt;P&gt;Details of that field are as below:&lt;/P&gt;

&lt;P&gt;Ouput of shell script:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; [root@splunkitsi bin]$ ./vmstat.sh
    memTotalMB   memFreeMB   memUsedMB  memFreePct  memUsedPct   pgPageOut  swapUsedPct   pgSwapOut   cSwitches  interrupts       forks   processes     threads  loadAvg1mi
         12863       12122         741        94.2         5.8   338955619          0.9       12696  2302182698  3016592159    15420967         130         407        1.08
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Content of Transforms.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;#memTotalMB   memFreeMB   memUsedMB  memFreePct  memUsedPct   pgPageOut  swapUsedPct   pgSwapOut   cSwitches  interrupts       forks   processes     threads  loadAvg1mi
    #      8192        4153        4039        50.7        49.3     1585619          5.0           ?           ?           ?           ?          82         566        0.72
    [fields_for_vmstat_sh]
    REGEX = \s+([0-9.?]+)\s+([0-9.?]+)\s+([0-9.?]+)\s+([0-9.?]+)\s+([0-9.?]+)\s+([0-9.?]+)\s+([0-9.?]+)\s+([0-9.?]+)\s+([0-9.?]+)\s+([0-9.?]+)\s+([0-9.?]+)\s+([0-9.?]+)\s+([0-9.?]+)\s+([0-9.?]+)
    FORMAT = memTotalMB::"$1" memFreeMB::"$2" memUsedMB::"$3" memFreePct::"$4" memUsedPct::"$5" pgPageOut::"$6" swapUsedPct::"$7" pgSwapOut::"$8" cSwitches::"$9" interrupts::"$10" forks::"$11" processes::"$12" threads::"$13" loadAvg1mi::"$14"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Contents of Props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[vmstat]
    LINE_BREAKER=(^$|[\r\n]+[\r\n]+)
    TRUNCATE=1000000
    DATETIME_CONFIG = CURRENT
    REPORT-0kv_for_vmstat = fields_for_vmstat_sh,vmstat_linux,vmstat_osx
    FIELDALIAS-dest_for_vmstat = host as dest
    EVAL-mem = if(isnotnull(memFreeMB) AND isnotnull(memUsedMB),(memFreeMB*1048576)+(memUsedMB*1048576),null())
    EVAL-mem_free = if(isnotnull(memFreeMB),memFreeMB*1048576,null())
    EVAL-mem_used = if(isnotnull(memUsedMB),memUsedMB*1048576,null())
    FIELDALIAS-src_for_vmstat = host as src
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Event output in Search query:&lt;BR /&gt;
&lt;IMG src="http://s14.postimg.org/3oxuvap1d/Capture.png" alt="alt text" /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Aug 2015 04:50:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-extract-event-values-using-REGEX-and-FORMAT/m-p/164864#M46824</guid>
      <dc:creator>ishangajera</dc:creator>
      <dc:date>2015-08-13T04:50:13Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I unable to extract event values using REGEX and FORMAT in transforms.conf and REPORT in props.conf?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-extract-event-values-using-REGEX-and-FORMAT/m-p/164865#M46825</link>
      <description>&lt;P&gt;I am stumped.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Aug 2015 18:17:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-extract-event-values-using-REGEX-and-FORMAT/m-p/164865#M46825</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-08-13T18:17:29Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I unable to extract event values using REGEX and FORMAT in transforms.conf and REPORT in props.conf?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-extract-event-values-using-REGEX-and-FORMAT/m-p/164866#M46826</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I am still not able to find the solution. Can anyone please help?&lt;/P&gt;</description>
      <pubDate>Tue, 18 Aug 2015 13:44:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-extract-event-values-using-REGEX-and-FORMAT/m-p/164866#M46826</guid>
      <dc:creator>ishangajera</dc:creator>
      <dc:date>2015-08-18T13:44:02Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I unable to extract event values using REGEX and FORMAT in transforms.conf and REPORT in props.conf?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-extract-event-values-using-REGEX-and-FORMAT/m-p/164867#M46827</link>
      <description>&lt;P&gt;Obviously he is extracting 0's because the raw data only has 0's.  Everything is working as expected.  The issue is in the raw data.  Look into why your box is sending all 0's&lt;/P&gt;

&lt;P&gt;Also, I am not seeing multi-line events.  That should not be a consideration in this case.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Sep 2015 15:21:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-extract-event-values-using-REGEX-and-FORMAT/m-p/164867#M46827</guid>
      <dc:creator>landen99</dc:creator>
      <dc:date>2015-09-11T15:21:07Z</dc:date>
    </item>
  </channel>
</rss>

