<?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 compute concurrent members in events? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-compute-concurrent-members-in-events/m-p/112169#M29444</link>
    <description>&lt;P&gt;@somesoni2: Some nuanced questions.&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;In &lt;CODE&gt;mvrange()&lt;/CODE&gt;, what is the significance of JobRunTime &lt;STRONG&gt;+&lt;/STRONG&gt; 1?  If I run this over jobs that connect end to tail, i.e., when one job finishes the next one starts, it seems that JobRunTime &lt;STRONG&gt;-&lt;/STRONG&gt; 1 would eliminate artificial overlaps. (I know that boundary conditions are prior knowledge and not a logical conclusion, so (0, JobRunTime) or (0, JobRunTime-1) will depend on use case.  Just want to know if JobRunTime+1 has a special meaning.)&lt;/LI&gt;
&lt;LI&gt;To follow on &lt;CODE&gt;mvrange() | mvexpand&lt;/CODE&gt;, it appears to me that (1,range) should work as well as (0,range), because event at &lt;CODE&gt;_time + 0&lt;/CODE&gt; should already have existed as the original event.  Does this sound right?&lt;/LI&gt;
&lt;LI&gt;How does mvrange determine increment when none is given?  Direct test using my data seems to show that it takes 1 minute increment.&lt;/LI&gt;
&lt;LI&gt;The first &lt;CODE&gt;stats&lt;/CODE&gt; uses &lt;CODE&gt;sum()&lt;/CODE&gt; as output, whereas the subsequent &lt;CODE&gt;timechart&lt;/CODE&gt; uses &lt;CODE&gt;max()&lt;/CODE&gt;.  Any particular consideration as to the use of sum() as opposed to using max() in both places?  (Particularities in my use case not described in this question, namely that my JobName is not always unique, sum() offer some limited advantages.)&lt;/LI&gt;
&lt;/UL&gt;</description>
    <pubDate>Tue, 27 Jan 2015 23:42:01 GMT</pubDate>
    <dc:creator>yuanliu</dc:creator>
    <dc:date>2015-01-27T23:42:01Z</dc:date>
    <item>
      <title>How to compute concurrent members in events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compute-concurrent-members-in-events/m-p/112158#M29433</link>
      <description>&lt;P&gt;Say, I have a series of jobs involving a certain number of members,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;_time        MemberCount  JobRunTime (min) JobName
01:00:00           100               15     Job1
01:05:00           200               30     Job2
01:15:00           300               50     Job3
01:30:00            80               10     Job4
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want to show that during the first 5 minutes, total number of members is 100, between 5 and 15 minutes, total is 300 (100+200), between 15 and 30 minutes, total is 500 (300 + 300 - 100), between 30 and 35 minutes, total is 580 (500 + 80), between 35 and 40 minutes, total is 380 (580 - 200), between 40 and 75 minutes, total is 300 (380 - 80), and so on.&lt;/P&gt;

&lt;P&gt;So this is like the task of calculating concurrency, but instead of mere concurrency of events, I want concurrent total of a field value.  The closest I have got is&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; [ original search] | appendpipe [
  eval _time=_time + JobRunTime*60
  ] | timechart max(MemberCount) by JobName
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will give me an "ending" event for each job start time, so I can connect the two dots as a straight line, and see that it overlaps with some other lines on time axis.  What I want is a column chart (or area chart as resolution increases) that stacks Job1's MemberCount on top of Job2's when it starts, and so on.  How do I do that?&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jan 2015 02:01:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compute-concurrent-members-in-events/m-p/112158#M29433</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2015-01-27T02:01:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to compute concurrent members in events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compute-concurrent-members-in-events/m-p/112159#M29434</link>
      <description>&lt;P&gt;In a way this is similar to the empty time bucket question (&lt;A href="http://answers.splunk.com/answers/149425/how-to-produce-empty-time-buckets.html"&gt;http://answers.splunk.com/answers/149425/how-to-produce-empty-time-buckets.html&lt;/A&gt;).  If, instead of filling "empty" time buckets with 0, we fill them with MemberCount of respective events, the job is done.  In other words, this problem has multiple start and end times to be handled.  If I can bucket time within each of these event intervals, there maybe a way to get answer.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jan 2015 05:55:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compute-concurrent-members-in-events/m-p/112159#M29434</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2015-01-27T05:55:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to compute concurrent members in events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compute-concurrent-members-in-events/m-p/112160#M29435</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/198iF3F7B8233191B4EE/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;Well, you need to hack it a bit further to get those timechart buckets filled correctly. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;your search here&amp;gt; | eval endtime=_time+JobRunTime*60  | timechart max(MemberCount) as Count max(endtime) as maxT by JobName | rename "Count: *" as *  | rename "maxT: Job*" as max* | filldown | foreach Job* [eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;=if(_time&amp;lt;max&amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt;, &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;, '')] | fields - max*
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Select Area chart and Format it as Stacked and Connected.alt text&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jan 2015 07:02:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compute-concurrent-members-in-events/m-p/112160#M29435</guid>
      <dc:creator>_d_</dc:creator>
      <dc:date>2015-01-27T07:02:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to compute concurrent members in events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compute-concurrent-members-in-events/m-p/112161#M29436</link>
      <description>&lt;P&gt;This is very helpful.  If I directly apply this, it only stacks count up, never takes away after JobRunTime.   Why so?  My data have a lot more jobs, but I have set limit=0 in timechart already.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jan 2015 08:04:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compute-concurrent-members-in-events/m-p/112161#M29436</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2015-01-27T08:04:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to compute concurrent members in events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compute-concurrent-members-in-events/m-p/112162#M29437</link>
      <description>&lt;P&gt;Not sure what "only stacks count up" means. The chart above was produced by applying the search on a table as below.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; _time, MemberCount, JobRunTime, JobName
1422336123, 100, 15, Job1
1422336423, 200, 30, Job2
1422337023, 300, 50, Job3
1422337923, 80, 10, Job4
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 27 Jan 2015 13:43:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compute-concurrent-members-in-events/m-p/112162#M29437</guid>
      <dc:creator>_d_</dc:creator>
      <dc:date>2015-01-27T13:43:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to compute concurrent members in events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compute-concurrent-members-in-events/m-p/112163#M29438</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | table _time JobName JobRunTime MemberCount | eval inc=mvrange(0,JobRunTime+1) | mvexpand inc | eval _time=_time + inc*60 | stats sum(MemberCount) as MemberCount by _time | timechart span=5m max(MemberCount) as ConcurrentMembers
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;With your sample data, output will be like this.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;_time   ConcurrentMemberCount
2015-01-27 01:00:00     100
2015-01-27 01:05:00     300
2015-01-27 01:10:00     300
2015-01-27 01:15:00     600
2015-01-27 01:20:00     500
2015-01-27 01:25:00     500
2015-01-27 01:30:00     580
2015-01-27 01:35:00     580
2015-01-27 01:40:00     380
2015-01-27 01:45:00     300
2015-01-27 01:50:00     300
2015-01-27 01:55:00     300
2015-01-27 02:00:00     300
2015-01-27 02:05:00     300 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 27 Jan 2015 16:12:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compute-concurrent-members-in-events/m-p/112163#M29438</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2015-01-27T16:12:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to compute concurrent members in events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compute-concurrent-members-in-events/m-p/112164#M29439</link>
      <description>&lt;P&gt;I mean the graph you obtained using the sample data in the question is perfect.  But I cannot get the same result on my real(ish) data; member counts simply add up and up, so the total becomes a monotonic increase.  Something I haven't understood about the use of &lt;CODE&gt;&amp;lt;&amp;gt;&lt;/CODE&gt; and so on, I guess. Using 4 jobs of same member count, each lasting close to 4 hours consecutively, I expect a flat stripe with different colour bands.  Instead, the bands just add up one after another to form a horn-like shape.  (I cannot use graph.)&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jan 2015 17:54:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compute-concurrent-members-in-events/m-p/112164#M29439</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2015-01-27T17:54:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to compute concurrent members in events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compute-concurrent-members-in-events/m-p/112165#M29440</link>
      <description>&lt;P&gt;Well, feel free to paste more data. &lt;/P&gt;</description>
      <pubDate>Tue, 27 Jan 2015 18:01:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compute-concurrent-members-in-events/m-p/112165#M29440</guid>
      <dc:creator>_d_</dc:creator>
      <dc:date>2015-01-27T18:01:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to compute concurrent members in events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compute-concurrent-members-in-events/m-p/112166#M29441</link>
      <description>&lt;P&gt;Excerllent!  Because the ability to single out top contributing jobs in a big peak is what I'm after, I need to do "by JobName".  But this is straightforward.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;my base search | table _time JobName JobRunTime MemberCount
 | eval inc=mvrange(0, JobRunTime+1) | mvexpand inc | eval _time=_time + inc*60
 | stats sum(MemberCount) as MemberCount by _time JobName
 | timechart span=1h max(MemberCount) as ConcurrentMembers by JobName
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;While I continue to digest the method and fine tune with conditions in my data and limitations of Splunk's graphics, this really eased my immediate pain. (I have been trying to do this for months if not years.)&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jan 2015 18:14:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compute-concurrent-members-in-events/m-p/112166#M29441</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2015-01-27T18:14:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to compute concurrent members in events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compute-concurrent-members-in-events/m-p/112167#M29442</link>
      <description>&lt;P&gt;When I compare what I retrieve from my sample data that give me a "horn shape" and the data posted in this question, they are not different.  So it must be something I didn't set up correctly in Splunk.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;_time   JobName JobRunTime  MemberCount
2014-08-05 10:05:00 76363659    179.75  380458
2014-08-05 06:05:00 76362122    114.75  380458
2014-08-05 02:05:00 76360937    207.75  380458
2014-08-04 22:05:00 76359961    201.75  380458
2014-08-04 18:05:00 76358947    206.75  380458
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 27 Jan 2015 18:23:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compute-concurrent-members-in-events/m-p/112167#M29442</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2015-01-27T18:23:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to compute concurrent members in events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compute-concurrent-members-in-events/m-p/112168#M29443</link>
      <description>&lt;P&gt;Just confirmed that it is not the dataset difference, but something wrong with my desktop/experimental Splunk 6.1.4.  I run your solution over limited real data on our production server (6.1.2), and the output looks normal and plausible.  No horn shape comes out.  I have yet to validate output manually, but I'm now more troubled by possible setup errors in my experimental Splunk.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jan 2015 18:40:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compute-concurrent-members-in-events/m-p/112168#M29443</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2015-01-27T18:40:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to compute concurrent members in events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compute-concurrent-members-in-events/m-p/112169#M29444</link>
      <description>&lt;P&gt;@somesoni2: Some nuanced questions.&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;In &lt;CODE&gt;mvrange()&lt;/CODE&gt;, what is the significance of JobRunTime &lt;STRONG&gt;+&lt;/STRONG&gt; 1?  If I run this over jobs that connect end to tail, i.e., when one job finishes the next one starts, it seems that JobRunTime &lt;STRONG&gt;-&lt;/STRONG&gt; 1 would eliminate artificial overlaps. (I know that boundary conditions are prior knowledge and not a logical conclusion, so (0, JobRunTime) or (0, JobRunTime-1) will depend on use case.  Just want to know if JobRunTime+1 has a special meaning.)&lt;/LI&gt;
&lt;LI&gt;To follow on &lt;CODE&gt;mvrange() | mvexpand&lt;/CODE&gt;, it appears to me that (1,range) should work as well as (0,range), because event at &lt;CODE&gt;_time + 0&lt;/CODE&gt; should already have existed as the original event.  Does this sound right?&lt;/LI&gt;
&lt;LI&gt;How does mvrange determine increment when none is given?  Direct test using my data seems to show that it takes 1 minute increment.&lt;/LI&gt;
&lt;LI&gt;The first &lt;CODE&gt;stats&lt;/CODE&gt; uses &lt;CODE&gt;sum()&lt;/CODE&gt; as output, whereas the subsequent &lt;CODE&gt;timechart&lt;/CODE&gt; uses &lt;CODE&gt;max()&lt;/CODE&gt;.  Any particular consideration as to the use of sum() as opposed to using max() in both places?  (Particularities in my use case not described in this question, namely that my JobName is not always unique, sum() offer some limited advantages.)&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Tue, 27 Jan 2015 23:42:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compute-concurrent-members-in-events/m-p/112169#M29444</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2015-01-27T23:42:01Z</dc:date>
    </item>
  </channel>
</rss>

