<?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: string to decimal and use where condition in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/string-to-decimal-and-use-where-condition/m-p/83940#M21390</link>
    <description>&lt;P&gt;Oh never mind, I found what went wrong. When a server has multiple values - some less than 1 and some more than 1, that server doesn't return in the result for search TimeTaken&amp;gt;1. I have to do the stats by Sever, _time. And that worked.&lt;/P&gt;</description>
    <pubDate>Thu, 04 Apr 2013 16:32:54 GMT</pubDate>
    <dc:creator>lain179</dc:creator>
    <dc:date>2013-04-04T16:32:54Z</dc:date>
    <item>
      <title>string to decimal and use where condition</title>
      <link>https://community.splunk.com/t5/Splunk-Search/string-to-decimal-and-use-where-condition/m-p/83938#M21388</link>
      <description>&lt;P&gt;I have extracted a field that represents how long a process takes. The values looks like 1.0435, 2.242, 234.23435, etc. Using rex, the values are stored as string, so I use &lt;STRONG&gt;convert auto(timetaken)&lt;/STRONG&gt;. Though it seems to convert it to number, I couldn't get the where clause to work. I searched for &lt;STRONG&gt;where timetake&amp;gt;1&lt;/STRONG&gt;, and I got much fewer results than I expected. Please help. Thanks.&lt;/P&gt;

&lt;P&gt;Here is my search syntax.&lt;/P&gt;

&lt;PRE&gt;
sourcetype="Engine Logs" done save | rex field=_raw ".*in (?&amp;lt;TimeTaken&amp;gt;[0-9\.]+) seconds.*SERVER\.(?&amp;lt;Server&amp;gt;.*)\.Engine" | convert auto(TimeTaken) | stats values(TimeTaken) as TimeTaken by Server | search TimeTaken&amp;gt;1
&lt;/PRE&gt;</description>
      <pubDate>Thu, 04 Apr 2013 00:25:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/string-to-decimal-and-use-where-condition/m-p/83938#M21388</guid>
      <dc:creator>lain179</dc:creator>
      <dc:date>2013-04-04T00:25:27Z</dc:date>
    </item>
    <item>
      <title>Re: string to decimal and use where condition</title>
      <link>https://community.splunk.com/t5/Splunk-Search/string-to-decimal-and-use-where-condition/m-p/83939#M21389</link>
      <description>&lt;P&gt;It would help if you posted your actual search. Typically, when using rex to extract a field and the regex extract numbers, including decimals, Splunk will take care of typing. So you don't really have to call convert. In any case, &lt;CODE&gt;where&lt;/CODE&gt; should work in filtering things out. &lt;/P&gt;

&lt;P&gt;Try this: &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;index=_internal sourcetype="splunkd_access" HTTP | head 100 | rex "HTTP/(?&amp;lt;http_version&amp;gt;[^\"]+)" | where http_version&amp;gt;1&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;and you should only see events with that contain "HTTP/1.1" but no "HTTP/1.0"&lt;/P&gt;

&lt;P&gt;Alternatively, you can use &lt;CODE&gt;search&lt;/CODE&gt; instead of &lt;CODE&gt;where&lt;/CODE&gt;. Ex. &lt;CODE&gt;| search timetaken&amp;gt;1&lt;/CODE&gt; &lt;/P&gt;</description>
      <pubDate>Thu, 04 Apr 2013 04:52:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/string-to-decimal-and-use-where-condition/m-p/83939#M21389</guid>
      <dc:creator>_d_</dc:creator>
      <dc:date>2013-04-04T04:52:25Z</dc:date>
    </item>
    <item>
      <title>Re: string to decimal and use where condition</title>
      <link>https://community.splunk.com/t5/Splunk-Search/string-to-decimal-and-use-where-condition/m-p/83940#M21390</link>
      <description>&lt;P&gt;Oh never mind, I found what went wrong. When a server has multiple values - some less than 1 and some more than 1, that server doesn't return in the result for search TimeTaken&amp;gt;1. I have to do the stats by Sever, _time. And that worked.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Apr 2013 16:32:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/string-to-decimal-and-use-where-condition/m-p/83940#M21390</guid>
      <dc:creator>lain179</dc:creator>
      <dc:date>2013-04-04T16:32:54Z</dc:date>
    </item>
  </channel>
</rss>

