<?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 How do I extract a time field and use it as the y axis? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-a-time-field-and-use-it-as-the-y-axis/m-p/19277#M2911</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;This is probably a very easy thing to do, but I did not seem to find a suitable answer in the documentation yet. What I am trying to do is extract a time from my events and use that time as the y-axis for a line chart. What I am trying right now is the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;`rex "\d:\d+:\d+\.\d+(?&amp;lt;TIME_TAKEN&amp;gt;)" | convert dur2sec(TIME_TAKEN) | chart first(TIME_TAKEN) by _time`
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;for events of the form: 0:13:23.233434 &lt;/P&gt;

&lt;P&gt;The trouble with this approach is that the "first(TIME_TAKEN)" column is empty. I would also like to keep this as a permanent chart - Following the videos there is a props.conf file to edit but I am not sure which. I am new to splunk.&lt;/P&gt;

&lt;P&gt;Thanks for the help.&lt;/P&gt;</description>
    <pubDate>Mon, 30 May 2011 14:35:15 GMT</pubDate>
    <dc:creator>the_guillaume</dc:creator>
    <dc:date>2011-05-30T14:35:15Z</dc:date>
    <item>
      <title>How do I extract a time field and use it as the y axis?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-a-time-field-and-use-it-as-the-y-axis/m-p/19277#M2911</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;This is probably a very easy thing to do, but I did not seem to find a suitable answer in the documentation yet. What I am trying to do is extract a time from my events and use that time as the y-axis for a line chart. What I am trying right now is the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;`rex "\d:\d+:\d+\.\d+(?&amp;lt;TIME_TAKEN&amp;gt;)" | convert dur2sec(TIME_TAKEN) | chart first(TIME_TAKEN) by _time`
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;for events of the form: 0:13:23.233434 &lt;/P&gt;

&lt;P&gt;The trouble with this approach is that the "first(TIME_TAKEN)" column is empty. I would also like to keep this as a permanent chart - Following the videos there is a props.conf file to edit but I am not sure which. I am new to splunk.&lt;/P&gt;

&lt;P&gt;Thanks for the help.&lt;/P&gt;</description>
      <pubDate>Mon, 30 May 2011 14:35:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-a-time-field-and-use-it-as-the-y-axis/m-p/19277#M2911</guid>
      <dc:creator>the_guillaume</dc:creator>
      <dc:date>2011-05-30T14:35:15Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract a time field and use it as the y axis?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-a-time-field-and-use-it-as-the-y-axis/m-p/19278#M2912</link>
      <description>&lt;P&gt;Your starting point should be a &lt;CODE&gt;timechart&lt;/CODE&gt; command, not &lt;CODE&gt;chart by _time&lt;/CODE&gt;, because the latter is just a clumsy partial version of the former.  Also I think &lt;CODE&gt;chart&lt;/CODE&gt; doesnt always play nice with &lt;CODE&gt;first&lt;/CODE&gt; and &lt;CODE&gt;last&lt;/CODE&gt;, since chart is designed to work only with numeric data,  and &lt;CODE&gt;first&lt;/CODE&gt; is generally used for categorical data.   Try this:  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex "\d:\d+:\d+.\d+(?&amp;lt;TIME_TAKEN&amp;gt;)" | convert dur2sec(TIME_TAKEN) | timechart sum(TIME_TAKEN) 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or you might try &lt;CODE&gt;max()&lt;/CODE&gt; or &lt;CODE&gt;min()&lt;/CODE&gt; or &lt;CODE&gt;avg()&lt;/CODE&gt; instead of the sum.   Or all of them together. &lt;/P&gt;

&lt;P&gt;UPDATE:   I think the problem was that your regex wasnt actually extracting your duration field:  try this instead: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex (?&amp;lt;TIME_TAKEN&amp;gt;\d:\d+:\d+.\d+)? | convert dur2sec(TIME_TAKEN) | timechart sum(TIME_TAKEN) 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 30 May 2011 15:51:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-a-time-field-and-use-it-as-the-y-axis/m-p/19278#M2912</guid>
      <dc:creator>sideview</dc:creator>
      <dc:date>2011-05-30T15:51:30Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract a time field and use it as the y axis?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-a-time-field-and-use-it-as-the-y-axis/m-p/19279#M2913</link>
      <description>&lt;P&gt;Thanks, I am pretty sure timechart is the way to go, but this still does not work. I get two columns with appropriate result when I only enter:  rex "\d:\d+:\d+.\d+(?&lt;TIME_TAKEN&gt;)" | convert dur2sec(TIME_TAKEN) but if I add | timechart max(TIME_TAKEN) (or any other function for that matter) I get no results in the max(TIME_TAKEN) column.&lt;/TIME_TAKEN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 09:37:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-a-time-field-and-use-it-as-the-y-axis/m-p/19279#M2913</guid>
      <dc:creator>the_guillaume</dc:creator>
      <dc:date>2020-09-28T09:37:43Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract a time field and use it as the y axis?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-a-time-field-and-use-it-as-the-y-axis/m-p/19280#M2914</link>
      <description>&lt;P&gt;Hi, I tried rex (?&lt;TIME_TAKEN&gt;\d:\d+:\d+.\d+)? | convert dur2sec(TIME_TAKEN) | timechart sum(TIME_TAKEN) but it gives me the same result as before. The duration seems to be extracted as I can get the correct values if I don't type timechart afunction(TIME_TAKEN) . Thanks again for the help.&lt;/TIME_TAKEN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 09:37:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-a-time-field-and-use-it-as-the-y-axis/m-p/19280#M2914</guid>
      <dc:creator>the_guillaume</dc:creator>
      <dc:date>2020-09-28T09:37:56Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract a time field and use it as the y axis?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-a-time-field-and-use-it-as-the-y-axis/m-p/19281#M2915</link>
      <description>&lt;P&gt;I think at this point it's just casing.  Fields are case-sensitive but unfortunately when I first wrote my answer I used lowercase in the rex command and uppercase everywhere else.   Field names are case-sensitive so I think the only problem remaining is that time_taken!=TIME_TAKEN.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 09:38:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-a-time-field-and-use-it-as-the-y-axis/m-p/19281#M2915</guid>
      <dc:creator>sideview</dc:creator>
      <dc:date>2020-09-28T09:38:01Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract a time field and use it as the y axis?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-a-time-field-and-use-it-as-the-y-axis/m-p/19282#M2916</link>
      <description>&lt;P&gt;I thought about that too and modified made sure everything was in small caps, but still no result. Hmm curiouser and curiouser...&lt;/P&gt;</description>
      <pubDate>Tue, 31 May 2011 18:42:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-a-time-field-and-use-it-as-the-y-axis/m-p/19282#M2916</guid>
      <dc:creator>the_guillaume</dc:creator>
      <dc:date>2011-05-31T18:42:26Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract a time field and use it as the y axis?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-a-time-field-and-use-it-as-the-y-axis/m-p/19283#M2917</link>
      <description>&lt;P&gt;to take a step back and sanity check.  Can you run &lt;/P&gt;

&lt;P&gt;&lt;YOUR search=""&gt; | rex (?&lt;TIME_TAKEN&gt;\d:\d+:\d+.\d+)? | table TIME_TAKEN&lt;/TIME_TAKEN&gt;&lt;/YOUR&gt;&lt;/P&gt;

&lt;P&gt;and post back what the values look like in the table?  Im guessing they're all blank which would mean that the regex is still not correct.&lt;/P&gt;</description>
      <pubDate>Tue, 31 May 2011 18:49:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-a-time-field-and-use-it-as-the-y-axis/m-p/19283#M2917</guid>
      <dc:creator>sideview</dc:creator>
      <dc:date>2011-05-31T18:49:17Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract a time field and use it as the y axis?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-a-time-field-and-use-it-as-the-y-axis/m-p/19284#M2918</link>
      <description>&lt;P&gt;You are right. The table is empty (I used small caps for both).  Here is the result:&lt;A href="http://www.flickr.com/photos/63543425@N07/5782440989/"&gt;http://www.flickr.com/photos/63543425@N07/5782440989/&lt;/A&gt;&lt;BR /&gt;
But here is the result for another search: &lt;A href="http://www.flickr.com/photos/63543425@N07/5783021226/"&gt;http://www.flickr.com/photos/63543425@N07/5783021226/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 31 May 2011 19:13:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-a-time-field-and-use-it-as-the-y-axis/m-p/19284#M2918</guid>
      <dc:creator>the_guillaume</dc:creator>
      <dc:date>2011-05-31T19:13:34Z</dc:date>
    </item>
  </channel>
</rss>

