<?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 to get a graph with respect to time spend vs number of events in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-get-a-graph-with-respect-to-time-spend-vs-number-of/m-p/295377#M18723</link>
    <description>&lt;P&gt;I have a program which is logging events after every 1 hour. Which means the job runs after every 1 hour. &lt;/P&gt;

&lt;P&gt;With every run it generates an &lt;CODE&gt;UniqueID&lt;/CODE&gt; and it stays through out the same until the program gets terminated for that hour's run. The program logs &lt;CODE&gt;FileName&lt;/CODE&gt; with it. To discriminate the start and stop of the program, it logs status as &lt;CODE&gt;Status=START&lt;/CODE&gt; and &lt;CODE&gt;Status=END&lt;/CODE&gt;. &lt;CODE&gt;Status&lt;/CODE&gt; is the field-name.  So for example below are the two sample runs.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=prg, _time=2:00, UniqueID=ID1, Status=START, Message="Program starts"
index=prg, _time=2:01, UniqueID=ID1, FileName=F1, Status=DEBUG, Message="File logged"
index=prg, _time=2:02, UniqueID=ID1, FileName=F2, Status=DEBUG, Message="File logged"
index=prg, _time=2:03, UniqueID=ID1, FileName=F3, Status=DEBUG, Message="File logged"
index=prg, _time=2:04, UniqueID=ID1, Status=END, Message="Program ends"

index=prg, _time=3:00, UniqueID=ID2, Status=START, Message="Program starts"
index=prg, _time=3:05, UniqueID=ID2, FileName=F11, Status=DEBUG, Message="File logged"
index=prg, _time=3:07, UniqueID=ID2, FileName=F12, Status=DEBUG, Message="File logged"
index=prg, _time=3:09, UniqueID=ID2, FileName=F13, Status=DEBUG, Message="File logged"
index=prg, _time=3:11, UniqueID=ID2, FileName=F17, Status=DEBUG, Message="File logged"
index=prg, _time=3:22, UniqueID=ID2, Status=END, Message="Program ends"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So with above example we could see &lt;CODE&gt;ID1&lt;/CODE&gt; took 4 minutes to end and logged 3 files, whereas &lt;CODE&gt;ID2&lt;/CODE&gt; took 22 minutes and logged 4 files. I need this in a graph, where time would be in Y axis and number of files would be in X axis. We want to see the trend... like for how many files what the time graph looks like.&lt;/P&gt;</description>
    <pubDate>Fri, 24 Nov 2017 10:59:56 GMT</pubDate>
    <dc:creator>anirban_nag</dc:creator>
    <dc:date>2017-11-24T10:59:56Z</dc:date>
    <item>
      <title>How to get a graph with respect to time spend vs number of events</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-get-a-graph-with-respect-to-time-spend-vs-number-of/m-p/295377#M18723</link>
      <description>&lt;P&gt;I have a program which is logging events after every 1 hour. Which means the job runs after every 1 hour. &lt;/P&gt;

&lt;P&gt;With every run it generates an &lt;CODE&gt;UniqueID&lt;/CODE&gt; and it stays through out the same until the program gets terminated for that hour's run. The program logs &lt;CODE&gt;FileName&lt;/CODE&gt; with it. To discriminate the start and stop of the program, it logs status as &lt;CODE&gt;Status=START&lt;/CODE&gt; and &lt;CODE&gt;Status=END&lt;/CODE&gt;. &lt;CODE&gt;Status&lt;/CODE&gt; is the field-name.  So for example below are the two sample runs.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=prg, _time=2:00, UniqueID=ID1, Status=START, Message="Program starts"
index=prg, _time=2:01, UniqueID=ID1, FileName=F1, Status=DEBUG, Message="File logged"
index=prg, _time=2:02, UniqueID=ID1, FileName=F2, Status=DEBUG, Message="File logged"
index=prg, _time=2:03, UniqueID=ID1, FileName=F3, Status=DEBUG, Message="File logged"
index=prg, _time=2:04, UniqueID=ID1, Status=END, Message="Program ends"

index=prg, _time=3:00, UniqueID=ID2, Status=START, Message="Program starts"
index=prg, _time=3:05, UniqueID=ID2, FileName=F11, Status=DEBUG, Message="File logged"
index=prg, _time=3:07, UniqueID=ID2, FileName=F12, Status=DEBUG, Message="File logged"
index=prg, _time=3:09, UniqueID=ID2, FileName=F13, Status=DEBUG, Message="File logged"
index=prg, _time=3:11, UniqueID=ID2, FileName=F17, Status=DEBUG, Message="File logged"
index=prg, _time=3:22, UniqueID=ID2, Status=END, Message="Program ends"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So with above example we could see &lt;CODE&gt;ID1&lt;/CODE&gt; took 4 minutes to end and logged 3 files, whereas &lt;CODE&gt;ID2&lt;/CODE&gt; took 22 minutes and logged 4 files. I need this in a graph, where time would be in Y axis and number of files would be in X axis. We want to see the trend... like for how many files what the time graph looks like.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Nov 2017 10:59:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-get-a-graph-with-respect-to-time-spend-vs-number-of/m-p/295377#M18723</guid>
      <dc:creator>anirban_nag</dc:creator>
      <dc:date>2017-11-24T10:59:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a graph with respect to time spend vs number of events</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-get-a-graph-with-respect-to-time-spend-vs-number-of/m-p/295378#M18724</link>
      <description>&lt;P&gt;Lots of ways to go with this.  First you need to prep the data...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=prg 
| bin _time as day span=1d
| stats 
    sum(eval(case(Status="DEBUG",1))) as filecount,
    range(_time) as duration 
    min(_time) as _time 
    by day UniqueID

| rename COMMENT as "The above gives you the following information, duration in seconds so you need to divide"
| table _time filecount duration day UniqueID 
| eval durationmin=round(duration/60,2) 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;With the above information, you can do any of the following:&lt;/P&gt;

&lt;P&gt;1) Calculate a static table&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats min(durationmin) as minminutes,
        max(durationmin) as maxminutes,
        avg(durationmin) as avgminutes,
        stdev(durationmin) as stdevminutes
        by filecount
| eval minminutes=round(minminutes,2)
| eval maxminutes=round(maxminutes,2)
| eval avgminutes=round(avgminutes,2)
| eval stdevminutes=round(stdevminutes,2)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;2) calculate a windowed daily average&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| appendpipe [
    | stats values(_time) as time values(filecount) as filecount 
    | mvexpand time
    | mvexpand filecount
    ]  
| stats values(*) as * by _time filecount
| streamstats timewindow=7d 
        avg(durationmin) as avgminutes
        by filecount
| eval avgminutes=round(avgminutes,2)
| timechart span=1d avg(avgminutes) as avgminutes by filecount 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or lots of other things.  Depends on what you are trying to see.&lt;/P&gt;</description>
      <pubDate>Sat, 25 Nov 2017 02:52:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-get-a-graph-with-respect-to-time-spend-vs-number-of/m-p/295378#M18724</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-11-25T02:52:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a graph with respect to time spend vs number of events</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-get-a-graph-with-respect-to-time-spend-vs-number-of/m-p/295379#M18725</link>
      <description>&lt;P&gt;Start with something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval raw="index=prg, _time=2:00, UniqueID=ID1, Status=START, Message=\"Program starts\"::index=prg, _time=2:01, UniqueID=ID1, FileName=F1, Status=DEBUG, Message=\"File logged\"::index=prg, _time=2:02, UniqueID=ID1, FileName=F2, Status=DEBUG, Message=\"File logged\"::index=prg, _time=2:03, UniqueID=ID1, FileName=F3, Status=DEBUG, Message=\"File logged\"::index=prg, _time=2:04, UniqueID=ID1, Status=END, Message=\"Program ends\"::index=prg, _time=3:00, UniqueID=ID2, Status=START, Message=\"Program starts\"::index=prg, _time=3:05, UniqueID=ID2, FileName=F11, Status=DEBUG, Message=\"File logged\":: index=prg, _time=3:07, UniqueID=ID2, FileName=F12, Status=DEBUG, Message=\"File logged\"::index=prg, _time=3:09, UniqueID=ID2, FileName=F13, Status=DEBUG, Message=\"File logged\"::index=prg, _time=3:11, UniqueID=ID2, FileName=F17, Status=DEBUG, Message=\"File logged\"::index=prg, _time=3:22, UniqueID=ID2, Status=END, Message=\"Program ends\""
| makemv delim="::" raw
| mvexpand raw
| rename raw AS _raw
| kv

| rename COMMENT AS "Everything above generates sample events; everything below is your solution"

| rex field=time "((?&amp;lt;hours&amp;gt;\d+):)?(?&amp;lt;minutes&amp;gt;\d+):(?&amp;lt;seconds&amp;gt;\d+)"
| fillnull value="0" hours minutes seconds
| eval time = seconds + (60 * (minutes + 60 * hours))
| fields - hours minutes seconds
| stats count(eval(Message="File logged")) AS files_logged sum(time) AS time BY UniqueID
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OK, so now you have your basic tabluar data but you need to decide the nature of your analysis.  I am taking a guess here:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| chart avg(files_logged) BY time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Pick your visualization and profit!&lt;/P&gt;</description>
      <pubDate>Sat, 25 Nov 2017 21:38:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-get-a-graph-with-respect-to-time-spend-vs-number-of/m-p/295379#M18725</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-11-25T21:38:47Z</dc:date>
    </item>
  </channel>
</rss>

