<?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 the string which contains time from my data, convert it to milliseconds, and display in a chart? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-the-string-which-contains-time-from-my-data/m-p/254107#M76088</link>
    <description>&lt;P&gt;you can try this assuming this data is in seconds.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your query to return events
| rex "(?&amp;lt;pre&amp;gt;[^\[]+)\[(?&amp;lt;number&amp;gt;[^\]]+)\]"
| eval millis=tonumber(number)*1000
| timechart avg(millis)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Use &lt;CODE&gt;avg(millis), max(millis) or min(millis)&lt;/CODE&gt; depending on what you want to chart. If you just want to tabulate it use &lt;CODE&gt;|table millis&lt;/CODE&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 02 Dec 2016 17:00:56 GMT</pubDate>
    <dc:creator>gokadroid</dc:creator>
    <dc:date>2016-12-02T17:00:56Z</dc:date>
    <item>
      <title>How do I extract the string which contains time from my data, convert it to milliseconds, and display in a chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-the-string-which-contains-time-from-my-data/m-p/254106#M76087</link>
      <description>&lt;P&gt;I have data like below which contains time taken for service call in regular string format.&lt;/P&gt;

&lt;P&gt;Sample Data :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Time Taken[0.122381]
Time Taken[0.122381]
Time Taken[0.122381]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How can i extract&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;String in between &lt;CODE&gt;[ ]&lt;/CODE&gt;&lt;/LI&gt;
&lt;LI&gt;Convert this to Milliseconds&lt;/LI&gt;
&lt;LI&gt;Present it in a chart&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2016 16:22:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-the-string-which-contains-time-from-my-data/m-p/254106#M76087</guid>
      <dc:creator>janibhasha</dc:creator>
      <dc:date>2016-12-02T16:22:49Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract the string which contains time from my data, convert it to milliseconds, and display in a chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-the-string-which-contains-time-from-my-data/m-p/254107#M76088</link>
      <description>&lt;P&gt;you can try this assuming this data is in seconds.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your query to return events
| rex "(?&amp;lt;pre&amp;gt;[^\[]+)\[(?&amp;lt;number&amp;gt;[^\]]+)\]"
| eval millis=tonumber(number)*1000
| timechart avg(millis)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Use &lt;CODE&gt;avg(millis), max(millis) or min(millis)&lt;/CODE&gt; depending on what you want to chart. If you just want to tabulate it use &lt;CODE&gt;|table millis&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2016 17:00:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-the-string-which-contains-time-from-my-data/m-p/254107#M76088</guid>
      <dc:creator>gokadroid</dc:creator>
      <dc:date>2016-12-02T17:00:56Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract the string which contains time from my data, convert it to milliseconds, and display in a chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-the-string-which-contains-time-from-my-data/m-p/254108#M76089</link>
      <description>&lt;P&gt;Or even all of the above:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | timechart max(millis), avg(millis), min(millis)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then your visualization should have all three.&lt;/P&gt;

&lt;P&gt;And if you'd like to rename them use &lt;CODE&gt;AS&lt;/CODE&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | timechart max(millis) AS Max, avg(millis) AS Average, min(millis) AS Min
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Happy Splunking!&lt;BR /&gt;
-Rich&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2016 17:41:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-the-string-which-contains-time-from-my-data/m-p/254108#M76089</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2016-12-02T17:41:31Z</dc:date>
    </item>
  </channel>
</rss>

