<?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 to convert a substring to a numeric value and evaluate the result? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-substring-to-a-numeric-value-and-evaluate-the/m-p/351334#M103996</link>
    <description>&lt;P&gt;It looks to make sense but I am not getting results. The field I have is a longer string and what I am looking for is a sub-string. Would I need to format this differently to account for this? So I have "xxxxx response time 42 ms xxxx". &lt;/P&gt;</description>
    <pubDate>Tue, 28 Mar 2017 13:07:33 GMT</pubDate>
    <dc:creator>aohls</dc:creator>
    <dc:date>2017-03-28T13:07:33Z</dc:date>
    <item>
      <title>How to convert a substring to a numeric value and evaluate the result?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-substring-to-a-numeric-value-and-evaluate-the/m-p/351329#M103991</link>
      <description>&lt;P&gt;In this scenario, I have the following log "response time 34 ms". I want to extract just the number, 34, and evaluate if it is greater than 30. How could I go about doing this?&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2017 19:01:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-substring-to-a-numeric-value-and-evaluate-the/m-p/351329#M103991</guid>
      <dc:creator>aohls</dc:creator>
      <dc:date>2017-03-10T19:01:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert a substring to a numeric value and evaluate the result?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-substring-to-a-numeric-value-and-evaluate-the/m-p/351330#M103992</link>
      <description>&lt;P&gt;You can try rex to begin with for your field extraction on sample data like one you have provided&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;Your Base Search&amp;gt;
| rex field=_raw "response\stime\s(?&amp;lt;ResponseTime&amp;gt;\d+)\sms"
| where ResponseTime&amp;gt;30
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;However, with you complete set of data, you should try Splunk Interactive Field Extraction to let Splunk figure out required regular expression for extracting Response Time from your events.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2017 20:24:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-substring-to-a-numeric-value-and-evaluate-the/m-p/351330#M103992</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-03-10T20:24:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert a substring to a numeric value and evaluate the result?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-substring-to-a-numeric-value-and-evaluate-the/m-p/351331#M103993</link>
      <description>&lt;P&gt;There can be multiple ways. One is&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your current search which includes 'yourfield' which has value in format "response time 34 ms"
| rex field=yourfield "response time (?&amp;lt;response_timems&amp;gt;\d+) ms" | eval result=if(response_timems&amp;gt;30,"&amp;gt;30","&amp;lt;=30)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;other options&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; your current search which includes 'yourfield' which has value in format "response time 34 ms"
    | eval response_timems=replace(yourfield,"[A-z\s:]","")  | eval result=if(response_timems&amp;gt;30,"&amp;gt;30","&amp;lt;=30)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 10 Mar 2017 20:25:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-substring-to-a-numeric-value-and-evaluate-the/m-p/351331#M103993</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-03-10T20:25:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert a substring to a numeric value and evaluate the result?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-substring-to-a-numeric-value-and-evaluate-the/m-p/351332#M103994</link>
      <description>&lt;P&gt;Thank you this is perfect. Is it then possible for me to take the time as an integer value and do a analysis from there. In short I now have all items I need that specify "response time 30 ms". I want to pull out the 30 from the string and essentially see if this value is increasing overtime. Is this possible?&lt;/P&gt;

&lt;P&gt;As this is a response time what I want to do is see if this value is increasing over time.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Mar 2017 13:13:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-substring-to-a-numeric-value-and-evaluate-the/m-p/351332#M103994</guid>
      <dc:creator>aohls</dc:creator>
      <dc:date>2017-03-27T13:13:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert a substring to a numeric value and evaluate the result?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-substring-to-a-numeric-value-and-evaluate-the/m-p/351333#M103995</link>
      <description>&lt;P&gt;Both searches will give you a field called response_timems (response time in milliseconds), which you can use to trend your response time. One way could be to create a line chart &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; your current search which includes 'yourfield' which has value in format "response time 34 ms"
 | rex field=yourfield "response time (?&amp;lt;response_timems&amp;gt;\d+) ms" | timechart avg(response_timems) as "Avg Response Time"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 27 Mar 2017 15:03:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-substring-to-a-numeric-value-and-evaluate-the/m-p/351333#M103995</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-03-27T15:03:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert a substring to a numeric value and evaluate the result?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-substring-to-a-numeric-value-and-evaluate-the/m-p/351334#M103996</link>
      <description>&lt;P&gt;It looks to make sense but I am not getting results. The field I have is a longer string and what I am looking for is a sub-string. Would I need to format this differently to account for this? So I have "xxxxx response time 42 ms xxxx". &lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2017 13:07:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-substring-to-a-numeric-value-and-evaluate-the/m-p/351334#M103996</guid>
      <dc:creator>aohls</dc:creator>
      <dc:date>2017-03-28T13:07:33Z</dc:date>
    </item>
  </channel>
</rss>

