<?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 plot Time (in hours) in Y-axis and Date in X-axis? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-plot-Time-in-hours-in-Y-axis-and-Date-in-X-axis/m-p/252178#M75435</link>
    <description>&lt;P&gt;Perhaps this is working &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main host="*"
                | stats earliest(_time) as First latest(_time) as Last by source, host | eval Date = strftime(First, "%Y-%m-%d")
               | eval difference= Last-First | eval difference=difference/3600 | chart eval(sum(difference)) as total_difference over Date by host
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 12 Oct 2016 15:10:05 GMT</pubDate>
    <dc:creator>smhsplunk</dc:creator>
    <dc:date>2016-10-12T15:10:05Z</dc:date>
    <item>
      <title>How to plot Time (in hours) in Y-axis and Date in X-axis?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-plot-Time-in-hours-in-Y-axis-and-Date-in-X-axis/m-p/252176#M75433</link>
      <description>&lt;P&gt;So I am trying to plot Hours in Y axis and the Time in the X-axis (the time is the first time events related to a particular host appeared).&lt;BR /&gt;
Please note I am accumulating time of each source (first and last event) and adding them to make total time of host (yes, I want to find exact time).&lt;/P&gt;

&lt;P&gt;So far I have this, it gives me barplot with time (not so sure about the last line) &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main host="*"
                | stats earliest(_time) as First latest(_time) as Last by source, host
                | eval difference=Last-First 
                | stats sum(difference) as total_difference by host
        | eval total_difference = total_difference/3600
                | chart max(total_difference) by host, First
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I don't have date on my X-axis &lt;BR /&gt;
I would like each host to have a different color and would like to order the hosts by date&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2016 13:37:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-plot-Time-in-hours-in-Y-axis-and-Date-in-X-axis/m-p/252176#M75433</guid>
      <dc:creator>smhsplunk</dc:creator>
      <dc:date>2016-10-12T13:37:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to plot Time (in hours) in Y-axis and Date in X-axis?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-plot-Time-in-hours-in-Y-axis-and-Date-in-X-axis/m-p/252177#M75434</link>
      <description>&lt;P&gt;Hi smhsplunk, &lt;/P&gt;

&lt;P&gt;I think the last line in your query should be: &lt;/P&gt;

&lt;P&gt;... &lt;BR /&gt;
&lt;STRONG&gt;| chart max(total_difference) over First by host&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Please see if it works. Thanks! &lt;BR /&gt;
Hunter Shen&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2016 14:41:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-plot-Time-in-hours-in-Y-axis-and-Date-in-X-axis/m-p/252177#M75434</guid>
      <dc:creator>hunters_splunk</dc:creator>
      <dc:date>2016-10-12T14:41:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to plot Time (in hours) in Y-axis and Date in X-axis?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-plot-Time-in-hours-in-Y-axis-and-Date-in-X-axis/m-p/252178#M75435</link>
      <description>&lt;P&gt;Perhaps this is working &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main host="*"
                | stats earliest(_time) as First latest(_time) as Last by source, host | eval Date = strftime(First, "%Y-%m-%d")
               | eval difference= Last-First | eval difference=difference/3600 | chart eval(sum(difference)) as total_difference over Date by host
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Oct 2016 15:10:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-plot-Time-in-hours-in-Y-axis-and-Date-in-X-axis/m-p/252178#M75435</guid>
      <dc:creator>smhsplunk</dc:creator>
      <dc:date>2016-10-12T15:10:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to plot Time (in hours) in Y-axis and Date in X-axis?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-plot-Time-in-hours-in-Y-axis-and-Date-in-X-axis/m-p/252179#M75436</link>
      <description>&lt;P&gt;This should do it.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main host="*"
                 | stats earliest(_time) as _time latest(_time) as Last by source, host
                 | eval difference=Last-_time 
                 | stats min(_time) as _time sum(difference) as total_difference by host
         | eval total_difference = total_difference/3600
             | table _time host total_difference
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Try this as well&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main host="*"
                 | stats earliest(_time) as _time latest(_time) as Last by source, host
                 | eval difference=Last-_time 
                 | stats min(_time) as _time sum(difference) as total_difference by host
         | eval total_difference = total_difference/3600
             | table _time host total_difference | xyseries _time host total_difference
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Oct 2016 15:59:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-plot-Time-in-hours-in-Y-axis-and-Date-in-X-axis/m-p/252179#M75436</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-10-12T15:59:08Z</dc:date>
    </item>
  </channel>
</rss>

