<?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: Building a gantt chart in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Building-a-gantt-chart/m-p/11965#M888</link>
    <description>&lt;P&gt;If you have time it took to complete from a Splunk event you have _time which is the start time (epoch time, in seconds), so you have the end time, too. You may have to do some math from _time and the run time to get to end time, but once there, the above strategy will work for you.&lt;/P&gt;</description>
    <pubDate>Mon, 23 Sep 2013 16:46:21 GMT</pubDate>
    <dc:creator>sowings</dc:creator>
    <dc:date>2013-09-23T16:46:21Z</dc:date>
    <item>
      <title>Building a gantt chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Building-a-gantt-chart/m-p/11961#M884</link>
      <description>&lt;P&gt;I saw the output of dbinspect and how it's used in the "Index health" graph on the "Index status" dashboard.  It looks pretty much like a gantt chart, which is how we would like to see client runs and how they overlap.&lt;/P&gt;

&lt;P&gt;Given log messages like this, where there may be multiple entries with the same fullJobID that are all parts of the same "run":&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2010-04-21 15:42:55,539 INFO  [Thread-3] () () () jobinfo Done: [client="foo", finished="2010-04-21 13:36:35", fullJobID="id.20100421_093039.foo.-.581473", started="2010-04-21 13:36:19"]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I ended up with this crazy search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="jobinfo" Done 
| convert timeformat="%Y-%m-%d %H:%M:%S.%N" mktime(started) as startedSeconds 
| convert timeformat="%Y-%m-%d %H:%M:%S.%N" mktime(finished) as finishedSeconds 
| stats max(finishedSeconds) as finishedSeconds min(startedSeconds) as startedSeconds by fullJobID client 
| sort - startedSeconds 
| eval runTime = finishedSeconds-startedSeconds 
| where runTime&amp;gt;300 
| streamstats count as runnum 
| eval combinedDate=startedSeconds.",".finishedSeconds 
| makemv delim="," combinedDate 
| mvexpand combinedDate 
| eval _time=combinedDate 
| timechart span=5m limit=0 first(runnum) by fullJobID
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You end up with a point for start and end for each job at the height of the runnum provided by streamstats.  Then setting Null values to "Connect", you get the desired result.&lt;/P&gt;

&lt;P&gt;I'm wondering if there are some commands I don't know about that would eliminate a few of the steps in here.  My combine/makemv/mvexpand combo seems a bit silly, for instance.&lt;/P&gt;

&lt;P&gt;Cheers,
Vincent&lt;/P&gt;</description>
      <pubDate>Thu, 22 Apr 2010 00:23:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Building-a-gantt-chart/m-p/11961#M884</guid>
      <dc:creator>vbumgarn</dc:creator>
      <dc:date>2010-04-22T00:23:44Z</dc:date>
    </item>
    <item>
      <title>Re: Building a gantt chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Building-a-gantt-chart/m-p/11962#M885</link>
      <description>&lt;P&gt;Nice.  Your eval + makemv + mvexpand trick is probably the shortest way to split each single event with the startSeconds and endSeconds fields into two events.&lt;BR /&gt;
while I can think of a couple considerably worse ways to get the same end result, i cant think of a better one. &lt;span class="lia-unicode-emoji" title=":grinning_face_with_big_eyes:"&gt;😃&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;some tiny comments &lt;/P&gt;

&lt;P&gt;1 your two convert commands can be combined into one. Whether the performance increase is significant i dont know, but it saves a little space. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| convert timeformat="%Y-%m-%d %H:%M:%S.%N" mktime(started) as startedSeconds mktime(finished) as finishedSeconds 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;2 limit is optional in timechart, and limit=0 is the default. &lt;/P&gt;

&lt;P&gt;3 Super minor but one of your evals could be done with strcat instead. I only mention this because once in a blue moon eval will do something not entirely desired, like round large decimal numbers a little. In this case obviously it wouldnt matter, and possibly since they added the "." operator to eval this is ancient history anyway. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| strcat startedSeconds "," finishedSeconds combinedDate
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 30 Apr 2010 12:29:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Building-a-gantt-chart/m-p/11962#M885</guid>
      <dc:creator>sideview</dc:creator>
      <dc:date>2010-04-30T12:29:24Z</dc:date>
    </item>
    <item>
      <title>Re: Building a gantt chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Building-a-gantt-chart/m-p/11963#M886</link>
      <description>&lt;P&gt;Thank you. My requirement was bit more than this. I posted question in forum &lt;A href="http://splunk-base.splunk.com/answers/86326/gantt-chart-in-splunk"&gt;http://splunk-base.splunk.com/answers/86326/gantt-chart-in-splunk&lt;/A&gt;. Can you please look into this?&lt;/P&gt;</description>
      <pubDate>Tue, 07 May 2013 06:43:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Building-a-gantt-chart/m-p/11963#M886</guid>
      <dc:creator>kasu_praveen</dc:creator>
      <dc:date>2013-05-07T06:43:27Z</dc:date>
    </item>
    <item>
      <title>Re: Building a gantt chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Building-a-gantt-chart/m-p/11964#M887</link>
      <description>&lt;P&gt;hi &lt;BR /&gt;
i don't have start and end seconds i have only process name and time it took to complete i want to make a gantt chart for the same .how can i go about it ?&lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2013 05:00:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Building-a-gantt-chart/m-p/11964#M887</guid>
      <dc:creator>ChhayaV</dc:creator>
      <dc:date>2013-09-23T05:00:17Z</dc:date>
    </item>
    <item>
      <title>Re: Building a gantt chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Building-a-gantt-chart/m-p/11965#M888</link>
      <description>&lt;P&gt;If you have time it took to complete from a Splunk event you have _time which is the start time (epoch time, in seconds), so you have the end time, too. You may have to do some math from _time and the run time to get to end time, but once there, the above strategy will work for you.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2013 16:46:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Building-a-gantt-chart/m-p/11965#M888</guid>
      <dc:creator>sowings</dc:creator>
      <dc:date>2013-09-23T16:46:21Z</dc:date>
    </item>
  </channel>
</rss>

