<?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: Extract a number from event message field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Extract-a-number-from-event-message-field/m-p/345812#M160702</link>
    <description>&lt;P&gt;This is what I have tried: &lt;BR /&gt;
APP_PATH="/Apiv0" EVENT_MESSAGE=Number of Offers ready to send | rex field=EVENT_MESSAGE "\D+(?\d+)" | table offercount&lt;/P&gt;

&lt;P&gt;My splunk log is: &lt;/P&gt;

&lt;P&gt;2017-06-15 03:00:12.8818; LOG_LEVEL=Info; SOURCE=JobRepository; APP_PATH=/Apiv0; VERSION=0.1.0.90; CORRELATION_IDENTIFIER=fe800697-df6a-4ce6-9438-27d106ab0005; SERVER=XXXX; EVENT_MESSAGE=Number of Offers ready to send: 6&lt;/P&gt;

&lt;P&gt;The result is:&lt;/P&gt;

&lt;P&gt;Events (14)&lt;BR /&gt;
 - ...&lt;BR /&gt;
Statistics (14)&lt;BR /&gt;
  -  Empty List&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 14:27:52 GMT</pubDate>
    <dc:creator>codebased</dc:creator>
    <dc:date>2020-09-29T14:27:52Z</dc:date>
    <item>
      <title>Extract a number from event message field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-a-number-from-event-message-field/m-p/345808#M160698</link>
      <description>&lt;P&gt;Hi Guys,&lt;/P&gt;

&lt;P&gt;I have been trying to extract the number at the end of &lt;STRONG&gt;EVENT_MESSAGE&lt;/STRONG&gt; field. &lt;/P&gt;

&lt;P&gt;Text sample: &lt;BR /&gt;
SERVER=SERVERNAME; EVENT_MESSAGE=Number of Offers ready to send: 6&lt;/P&gt;

&lt;P&gt;I am using the following query:&lt;/P&gt;

&lt;P&gt;rex field=EVENT_MESSAGE "Number of Offers ready to send: (?&amp;lt;offercount&amp;gt;\d+$)" | table offercount&lt;/P&gt;

&lt;P&gt;However I am not getting any result; the offercount result is empty.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2017 05:18:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-a-number-from-event-message-field/m-p/345808#M160698</guid>
      <dc:creator>codebased</dc:creator>
      <dc:date>2017-06-14T05:18:38Z</dc:date>
    </item>
    <item>
      <title>Re: Extract a number from event message field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-a-number-from-event-message-field/m-p/345809#M160699</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex field=EVENT_MESSAGE "Number of Offers ready to send: (?&amp;lt;offercount&amp;gt;\d+)" | table offercount
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 14 Jun 2017 06:06:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-a-number-from-event-message-field/m-p/345809#M160699</guid>
      <dc:creator>dineshraj9</dc:creator>
      <dc:date>2017-06-14T06:06:58Z</dc:date>
    </item>
    <item>
      <title>Re: Extract a number from event message field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-a-number-from-event-message-field/m-p/345810#M160700</link>
      <description>&lt;P&gt;Thank you @dineshraj9. I was actually using ? but somehow it got removed from my original question. I have copied your snippet as it is but it is not working :(. The offercount is all empty.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2017 06:53:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-a-number-from-event-message-field/m-p/345810#M160700</guid>
      <dc:creator>codebased</dc:creator>
      <dc:date>2017-06-14T06:53:37Z</dc:date>
    </item>
    <item>
      <title>Re: Extract a number from event message field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-a-number-from-event-message-field/m-p/345811#M160701</link>
      <description>&lt;P&gt;Can you paste the exact value in the EVENT_MESSAGE field? when I tested with the sample provided by you it worked.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval EVENT_MESSAGE="Number of Offers ready to send: 6" | rex field=EVENT_MESSAGE "\D+(?&amp;lt;offercount&amp;gt;\d+)" | table offercount
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You could also try -&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;your search&amp;gt; | rex field=EVENT_MESSAGE "\D+(?&amp;lt;offercount&amp;gt;\d+)" | table offercount
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 14 Jun 2017 06:57:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-a-number-from-event-message-field/m-p/345811#M160701</guid>
      <dc:creator>dineshraj9</dc:creator>
      <dc:date>2017-06-14T06:57:24Z</dc:date>
    </item>
    <item>
      <title>Re: Extract a number from event message field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-a-number-from-event-message-field/m-p/345812#M160702</link>
      <description>&lt;P&gt;This is what I have tried: &lt;BR /&gt;
APP_PATH="/Apiv0" EVENT_MESSAGE=Number of Offers ready to send | rex field=EVENT_MESSAGE "\D+(?\d+)" | table offercount&lt;/P&gt;

&lt;P&gt;My splunk log is: &lt;/P&gt;

&lt;P&gt;2017-06-15 03:00:12.8818; LOG_LEVEL=Info; SOURCE=JobRepository; APP_PATH=/Apiv0; VERSION=0.1.0.90; CORRELATION_IDENTIFIER=fe800697-df6a-4ce6-9438-27d106ab0005; SERVER=XXXX; EVENT_MESSAGE=Number of Offers ready to send: 6&lt;/P&gt;

&lt;P&gt;The result is:&lt;/P&gt;

&lt;P&gt;Events (14)&lt;BR /&gt;
 - ...&lt;BR /&gt;
Statistics (14)&lt;BR /&gt;
  -  Empty List&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 14:27:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-a-number-from-event-message-field/m-p/345812#M160702</guid>
      <dc:creator>codebased</dc:creator>
      <dc:date>2020-09-29T14:27:52Z</dc:date>
    </item>
    <item>
      <title>Re: Extract a number from event message field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-a-number-from-event-message-field/m-p/345813#M160703</link>
      <description>&lt;P&gt;Just for grins, try this - &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=_raw "Number of Offers ready to send: (?&amp;lt;offercount&amp;gt;\d+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If it works, then &lt;CODE&gt;EVENT_MESSAGE&lt;/CODE&gt; is probably somehow not an extracted field.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2017 02:25:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-a-number-from-event-message-field/m-p/345813#M160703</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-06-15T02:25:17Z</dc:date>
    </item>
    <item>
      <title>Re: Extract a number from event message field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-a-number-from-event-message-field/m-p/345814#M160704</link>
      <description>&lt;P&gt;Unless you have some customised field extraction for EVENT_MESSAGE, Splunk will automatically assign "Number" to EVENT_MESSAGE instead of "Number of Offers ready to send: 6" that &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/49110"&gt;@codebased&lt;/a&gt; seems to expect.  The above should work. (field=_raw is assumed by default so no need to specify.)&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 14:30:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-a-number-from-event-message-field/m-p/345814#M160704</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2020-09-29T14:30:26Z</dc:date>
    </item>
    <item>
      <title>Re: Extract a number from event message field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-a-number-from-event-message-field/m-p/345815#M160705</link>
      <description>&lt;P&gt;Indeed it is not a field!&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2017 04:53:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-a-number-from-event-message-field/m-p/345815#M160705</guid>
      <dc:creator>codebased</dc:creator>
      <dc:date>2017-06-15T04:53:08Z</dc:date>
    </item>
    <item>
      <title>Re: Extract a number from event message field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-a-number-from-event-message-field/m-p/345816#M160706</link>
      <description>&lt;P&gt;Thank you so much for your help. It is resolved. I had to use _raw.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2017 04:53:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-a-number-from-event-message-field/m-p/345816#M160706</guid>
      <dc:creator>codebased</dc:creator>
      <dc:date>2017-06-15T04:53:24Z</dc:date>
    </item>
    <item>
      <title>Re: Extract a number from event message field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-a-number-from-event-message-field/m-p/345817#M160707</link>
      <description>&lt;P&gt;@codebased - I suspected so. &lt;/P&gt;

&lt;P&gt;@yuanliu is correct that &lt;CODE&gt;field=_raw&lt;/CODE&gt; is default, but on these forums I like to be explicit, in case a reader doesn't understand that the &lt;CODE&gt;rex&lt;/CODE&gt; is operating on some specific field... like the one that in this case didn't exist...&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2017 14:23:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-a-number-from-event-message-field/m-p/345817#M160707</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-06-15T14:23:45Z</dc:date>
    </item>
  </channel>
</rss>

