<?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 Parsing us and ms times (e.g. q=15ms) in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Parsing-us-and-ms-times-e-g-q-15ms/m-p/17410#M2441</link>
    <description>&lt;P&gt;We have a log line that looks like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Jul 14 15:47:34 127.0.0.1 1 [000004ff000216970000489c] Serv foo.com 158578_40df389_527b/127.0.0.1:10465 2/10 ql=0 rt=49us wait=0ms sok=2ms tot=2ms sv=175ms ut=7us xfr=1093944
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'd like to be able to run a query where I find all entries where the wait is greater than 200ms for example.  Splunk is parsing it as a text field right now though.  Suggestions on how to get this numeric?  I don't care about the units really - the fact that some numbers are milliseconds and some are microseconds doesn't matter in splunk if that helps.&lt;/P&gt;</description>
    <pubDate>Thu, 15 Jul 2010 02:51:49 GMT</pubDate>
    <dc:creator>Oren</dc:creator>
    <dc:date>2010-07-15T02:51:49Z</dc:date>
    <item>
      <title>Parsing us and ms times (e.g. q=15ms)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Parsing-us-and-ms-times-e-g-q-15ms/m-p/17410#M2441</link>
      <description>&lt;P&gt;We have a log line that looks like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Jul 14 15:47:34 127.0.0.1 1 [000004ff000216970000489c] Serv foo.com 158578_40df389_527b/127.0.0.1:10465 2/10 ql=0 rt=49us wait=0ms sok=2ms tot=2ms sv=175ms ut=7us xfr=1093944
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'd like to be able to run a query where I find all entries where the wait is greater than 200ms for example.  Splunk is parsing it as a text field right now though.  Suggestions on how to get this numeric?  I don't care about the units really - the fact that some numbers are milliseconds and some are microseconds doesn't matter in splunk if that helps.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jul 2010 02:51:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Parsing-us-and-ms-times-e-g-q-15ms/m-p/17410#M2441</guid>
      <dc:creator>Oren</dc:creator>
      <dc:date>2010-07-15T02:51:49Z</dc:date>
    </item>
    <item>
      <title>Re: Parsing us and ms times (e.g. q=15ms)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Parsing-us-and-ms-times-e-g-q-15ms/m-p/17411#M2442</link>
      <description>&lt;P&gt;If your events would contain "&lt;CODE&gt;q=15ms&lt;/CODE&gt;"you could extract the numerical value using the rex command:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;your search&amp;gt; | rex field=q "(?&amp;lt;q_numeric&amp;gt;\d+)(?&amp;lt;q_unit&amp;gt;\D+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The field &lt;CODE&gt;q_numeric&lt;/CODE&gt; would then contain the numeric value 15 and q_unit with the value "ms"&lt;/P&gt;

&lt;P&gt;You could also normalize the value of q_numeric like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval q_us=if(q_unit="ms", q_numeric*1000, q_numeric)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and filter out those events &amp;gt; 200ms with&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | where q_us&amp;gt;200000
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Jul 2010 03:10:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Parsing-us-and-ms-times-e-g-q-15ms/m-p/17411#M2442</guid>
      <dc:creator>ziegfried</dc:creator>
      <dc:date>2010-07-15T03:10:07Z</dc:date>
    </item>
  </channel>
</rss>

