<?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 do I extract a number from the raw message in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-a-number-from-the-raw-message/m-p/211970#M187889</link>
    <description>&lt;P&gt;Many thanks for the answer!&lt;/P&gt;</description>
    <pubDate>Thu, 04 Aug 2016 15:26:56 GMT</pubDate>
    <dc:creator>JeffCr</dc:creator>
    <dc:date>2016-08-04T15:26:56Z</dc:date>
    <item>
      <title>How do I extract a number from the raw message</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-a-number-from-the-raw-message/m-p/211965#M187884</link>
      <description>&lt;P&gt;How do I extract the following which always occurs as the last part of the raw text in message e.g "Took 13983.1468ms."&lt;BR /&gt;
I want only the number and to capture timestamp and hostname. The total message length and structure might vary slightly but the ending is the same.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Aug 2016 14:49:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-a-number-from-the-raw-message/m-p/211965#M187884</guid>
      <dc:creator>JeffCr</dc:creator>
      <dc:date>2016-08-04T14:49:26Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract a number from the raw message</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-a-number-from-the-raw-message/m-p/211966#M187885</link>
      <description>&lt;P&gt;You would use a regular expression.. &lt;/P&gt;

&lt;P&gt;Try this &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;| rex (?P&amp;lt;Time&amp;gt;(?&amp;lt;=Took\s)\d+(?=ms))&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Aug 2016 14:52:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-a-number-from-the-raw-message/m-p/211966#M187885</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2016-08-04T14:52:59Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract a number from the raw message</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-a-number-from-the-raw-message/m-p/211967#M187886</link>
      <description>&lt;P&gt;I'd use &lt;CODE&gt;rex&lt;/CODE&gt;.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=foo | rex "Took (?&amp;lt;num&amp;gt;\d+\.?\d+)ms" | ...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you need help extracting timestamp and hostname, please show some sample data.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Aug 2016 14:54:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-a-number-from-the-raw-message/m-p/211967#M187886</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2016-08-04T14:54:47Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract a number from the raw message</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-a-number-from-the-raw-message/m-p/211968#M187887</link>
      <description>&lt;P&gt;Whats the easiest way to search the result set and then alert on a threshold value(s). Do I need to pass this into a command to build a table first?&lt;/P&gt;</description>
      <pubDate>Thu, 04 Aug 2016 15:09:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-a-number-from-the-raw-message/m-p/211968#M187887</guid>
      <dc:creator>JeffCr</dc:creator>
      <dc:date>2016-08-04T15:09:05Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract a number from the raw message</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-a-number-from-the-raw-message/m-p/211969#M187888</link>
      <description>&lt;P&gt;To alert on certain values, schedule a search for those values.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=foo | rex "Took (?&amp;lt;num&amp;gt;\d+\.?\d+)ms" | where num &amp;gt; someThreshold | table _time hostname num
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Have the search trigger an alert if the number of results is not zero.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Aug 2016 15:13:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-a-number-from-the-raw-message/m-p/211969#M187888</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2016-08-04T15:13:16Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract a number from the raw message</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-a-number-from-the-raw-message/m-p/211970#M187889</link>
      <description>&lt;P&gt;Many thanks for the answer!&lt;/P&gt;</description>
      <pubDate>Thu, 04 Aug 2016 15:26:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-a-number-from-the-raw-message/m-p/211970#M187889</guid>
      <dc:creator>JeffCr</dc:creator>
      <dc:date>2016-08-04T15:26:56Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract a number from the raw message</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-a-number-from-the-raw-message/m-p/211971#M187890</link>
      <description>&lt;P&gt;I think that regex is going to surprise in some situations. You are requiring that there be 2 digits. 1 or more digits, followed by optional decimal, followed by 1 or more digits.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Aug 2016 15:28:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-a-number-from-the-raw-message/m-p/211971#M187890</guid>
      <dc:creator>twinspop</dc:creator>
      <dc:date>2016-08-04T15:28:39Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract a number from the raw message</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-a-number-from-the-raw-message/m-p/211972#M187891</link>
      <description>&lt;P&gt;This doesn't allow for decimals.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Aug 2016 15:29:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-a-number-from-the-raw-message/m-p/211972#M187891</guid>
      <dc:creator>twinspop</dc:creator>
      <dc:date>2016-08-04T15:29:48Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract a number from the raw message</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-a-number-from-the-raw-message/m-p/211973#M187892</link>
      <description>&lt;P&gt;There will always be at least x.x&lt;/P&gt;</description>
      <pubDate>Thu, 04 Aug 2016 15:30:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-a-number-from-the-raw-message/m-p/211973#M187892</guid>
      <dc:creator>JeffCr</dc:creator>
      <dc:date>2016-08-04T15:30:13Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract a number from the raw message</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-a-number-from-the-raw-message/m-p/211974#M187893</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| rex "Took (?P&amp;lt;dur&amp;gt;\d+\.?\d*)ms"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Will put the value into &lt;CODE&gt;dur&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Aug 2016 15:31:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-a-number-from-the-raw-message/m-p/211974#M187893</guid>
      <dc:creator>twinspop</dc:creator>
      <dc:date>2016-08-04T15:31:02Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract a number from the raw message</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-a-number-from-the-raw-message/m-p/211975#M187894</link>
      <description>&lt;P&gt;Sorry about that, try this &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;| rex (?P&amp;lt;Time&amp;gt;(?&amp;lt;=Took\s)\d+\.\d+(?=ms))&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Aug 2016 15:53:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-a-number-from-the-raw-message/m-p/211975#M187894</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2016-08-04T15:53:18Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract a number from the raw message</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-a-number-from-the-raw-message/m-p/211976#M187895</link>
      <description>&lt;P&gt;No you don't need to do that, you can add a &lt;CODE&gt;| where&lt;/CODE&gt; clause such as &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;... | where Time &amp;gt; 2&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Aug 2016 15:54:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-a-number-from-the-raw-message/m-p/211976#M187895</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2016-08-04T15:54:08Z</dc:date>
    </item>
  </channel>
</rss>

