<?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: _time, calculations in transactions and mvlist in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/time-calculations-in-transactions-and-mvlist/m-p/196650#M56755</link>
    <description>&lt;P&gt;I'm not able to share sample data (industry, not a personal project). The data I am looking at come in from a sensor interfacing with Splunk in real time. The data in unit/unit time is stored in a field called Value, and the time information is stored in the standard _time field.  &lt;/P&gt;

&lt;P&gt;I am trying to (correctly) totalize or sum up total units within a window of time using the rate data. Put another way, I'm trying to use splunk to do numerical integration. &lt;/P&gt;

&lt;P&gt;I described what I am seeing in text as best as I could below. &lt;/P&gt;</description>
    <pubDate>Tue, 07 Jul 2015 18:20:17 GMT</pubDate>
    <dc:creator>ErikaE</dc:creator>
    <dc:date>2015-07-07T18:20:17Z</dc:date>
    <item>
      <title>_time, calculations in transactions and mvlist</title>
      <link>https://community.splunk.com/t5/Splunk-Search/time-calculations-in-transactions-and-mvlist/m-p/196646#M56751</link>
      <description>&lt;P&gt;When I run a transaction command to group events together, I lose the _time information originally associated with those events. &lt;/P&gt;

&lt;P&gt;I have PLC sensor data in the form unit/unit time that I am trying to totalize over time. A previous question: &lt;A href="http://answers.splunk.com/answers/261503/totalize-a-rate-over-time.html#answer-266956"&gt;http://answers.splunk.com/answers/261503/totalize-a-rate-over-time.html#answer-266956&lt;/A&gt; solved the problem of how to implement a total, but I found that it didn't work for discontinuous data. &lt;/P&gt;

&lt;P&gt;I am now trying something like this: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sensor Value&amp;gt;# | transaction maxpause=2m maxevents=-1  
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;which will successfully filter the events and group them into continuous runs of good data. In the set I'm working with this returns 5 transactions. &lt;/P&gt;

&lt;P&gt;Next, I need to be able to do a trapezoidal sum on the values grouped by those transactions, with _time as the x unit.  What I can't figure out is how to get the solution I was given to work with transaction data. I found some examples, but none that needed to use the _time field after applying a transaction. &lt;/P&gt;

&lt;P&gt;If I ask mvlist to return the _time value the search breaks down and does not return the correct number of events from the transaction command. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sensor Value&amp;gt;# | transaction maxpause=2m maxevents=-1 mvlist=_time, Value 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The above does not return the correct # of events. &lt;/P&gt;

&lt;P&gt;I am new to splunk, coming from a manufacturing and not a coding background, and trying to figure out how to get splunk to do routine tasks I already do in other programs.   Any help would be much appreciated! &lt;/P&gt;</description>
      <pubDate>Tue, 07 Jul 2015 17:18:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/time-calculations-in-transactions-and-mvlist/m-p/196646#M56751</guid>
      <dc:creator>ErikaE</dc:creator>
      <dc:date>2015-07-07T17:18:59Z</dc:date>
    </item>
    <item>
      <title>Re: _time, calculations in transactions and mvlist</title>
      <link>https://community.splunk.com/t5/Splunk-Search/time-calculations-in-transactions-and-mvlist/m-p/196647#M56752</link>
      <description>&lt;P&gt;Edit:&lt;/P&gt;

&lt;P&gt;What about something like this?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sensor Value&amp;gt;#
| eval time = _time
| delta value as valueDelta
| delta time as timeDelta
| table _time, time, timeDelta, Value, valueDelta
| eval area = time_delta * (Value + valueDelta)/2
| stats sum(area) as total
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You could also try adding this after eval instead:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| bucket _time span=5m
| stats sum(area) by _time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;if you needed it in more specific time chunks.&lt;/P&gt;

&lt;HR /&gt;

&lt;HR /&gt;

&lt;HR /&gt;

&lt;P&gt;Can you try capturing your time in a separate field, and then allowing the _time to stay internal?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; sensor Value&amp;gt;#
| eval time = _time
| transaction maxpause=2m maxevents=-1 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Alternatively, you could try capturing some subset of the time information for the mvlist, for example, minutes:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; sensor Value&amp;gt;#
| eval some_unit_of_tine = strftime(_time, "%m")
| transaction maxpause=2m maxevents=-1 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here is an example screenshot, where I am grouping on the &lt;CODE&gt;JSESSIONID&lt;/CODE&gt; field, but you'll see I have access to both bytes &amp;amp; time (for each event) and don't need to use &lt;CODE&gt;mvlist&lt;/CODE&gt;.&lt;BR /&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/452i180099FA94EAE48F/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Read more on common time options &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.2/SearchReference/Commontimeformatvariables"&gt;here&lt;/A&gt; and the eval command &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.2/SearchReference/CommonEvalFunctions"&gt;here&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jul 2015 17:25:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/time-calculations-in-transactions-and-mvlist/m-p/196647#M56752</guid>
      <dc:creator>aljohnson_splun</dc:creator>
      <dc:date>2015-07-07T17:25:59Z</dc:date>
    </item>
    <item>
      <title>Re: _time, calculations in transactions and mvlist</title>
      <link>https://community.splunk.com/t5/Splunk-Search/time-calculations-in-transactions-and-mvlist/m-p/196648#M56753</link>
      <description>&lt;P&gt;If your data is indeed "discontinuous" then you will be most dissatisfied with the performance (failure) of &lt;CODE&gt;transaction&lt;/CODE&gt;.  Give us sample data and current search with its output and then describe the desired output (as mocked up from your sample data).  That is the only way that you are going to get a good answer to this question.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jul 2015 17:33:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/time-calculations-in-transactions-and-mvlist/m-p/196648#M56753</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-07-07T17:33:36Z</dc:date>
    </item>
    <item>
      <title>Re: _time, calculations in transactions and mvlist</title>
      <link>https://community.splunk.com/t5/Splunk-Search/time-calculations-in-transactions-and-mvlist/m-p/196649#M56754</link>
      <description>&lt;P&gt;When I do this, the transaction search I am using breaks down. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sensor Value&amp;gt;# 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;returns 18,840 events in the specified time range &lt;/P&gt;

&lt;P&gt;Adding &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sensor Value&amp;gt;# | eval time = _time | transaction maxpause=2m maxevents=-1 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;returns 5 transactions (representing 5 segments of continuous rate data) &lt;/P&gt;

&lt;P&gt;Adding  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sensor Value&amp;gt;# | eval time = _time | transaction maxpause=2m maxevents=-1 mvlist=Value,time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;returns 18,840 events, with no information from the transactions retained.  &lt;/P&gt;

&lt;P&gt;The totalizing search runs exactly as before with the aforementioned discontinuous jumps. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sensor Value&amp;gt;#| eval time = _time | transaction maxpause=2m maxevents=-1 mvlist=Value,time | reverse
 | streamstats last(Value) as lastValue last(time) as lastTime current=f window=1
 | eval area=(time - lastTime)*(Value+lastValue)/2
 | streamstats sum(area) as total
 | timechart span=5m max(total) as total
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I will see if I can find a way to post an image. We have a lot of sites blocked on our internal network. &lt;/P&gt;</description>
      <pubDate>Tue, 07 Jul 2015 18:18:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/time-calculations-in-transactions-and-mvlist/m-p/196649#M56754</guid>
      <dc:creator>ErikaE</dc:creator>
      <dc:date>2015-07-07T18:18:35Z</dc:date>
    </item>
    <item>
      <title>Re: _time, calculations in transactions and mvlist</title>
      <link>https://community.splunk.com/t5/Splunk-Search/time-calculations-in-transactions-and-mvlist/m-p/196650#M56755</link>
      <description>&lt;P&gt;I'm not able to share sample data (industry, not a personal project). The data I am looking at come in from a sensor interfacing with Splunk in real time. The data in unit/unit time is stored in a field called Value, and the time information is stored in the standard _time field.  &lt;/P&gt;

&lt;P&gt;I am trying to (correctly) totalize or sum up total units within a window of time using the rate data. Put another way, I'm trying to use splunk to do numerical integration. &lt;/P&gt;

&lt;P&gt;I described what I am seeing in text as best as I could below. &lt;/P&gt;</description>
      <pubDate>Tue, 07 Jul 2015 18:20:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/time-calculations-in-transactions-and-mvlist/m-p/196650#M56755</guid>
      <dc:creator>ErikaE</dc:creator>
      <dc:date>2015-07-07T18:20:17Z</dc:date>
    </item>
    <item>
      <title>Re: _time, calculations in transactions and mvlist</title>
      <link>https://community.splunk.com/t5/Splunk-Search/time-calculations-in-transactions-and-mvlist/m-p/196651#M56756</link>
      <description>&lt;P&gt;OK, then share some fields.  How do you know that an event is from a particular sensor; is it that they have the same &lt;CODE&gt;host&lt;/CODE&gt; value or something else?  Genericize one event and then tell us what fields are in it.  It is not reasonable to expect a specific answer without more specific details.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jul 2015 18:23:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/time-calculations-in-transactions-and-mvlist/m-p/196651#M56756</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-07-07T18:23:26Z</dc:date>
    </item>
    <item>
      <title>Re: _time, calculations in transactions and mvlist</title>
      <link>https://community.splunk.com/t5/Splunk-Search/time-calculations-in-transactions-and-mvlist/m-p/196652#M56757</link>
      <description>&lt;P&gt;I see. &lt;/P&gt;

&lt;P&gt;So given the output of&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; sensor Value&amp;gt;# | eval time = _time | transaction maxpause=2m maxevents=-1 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Do you not have access to the individual &lt;CODE&gt;time&lt;/CODE&gt; and &lt;CODE&gt;Value&lt;/CODE&gt; values?  You should be able to see all of them without using mvlist.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jul 2015 18:30:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/time-calculations-in-transactions-and-mvlist/m-p/196652#M56757</guid>
      <dc:creator>aljohnson_splun</dc:creator>
      <dc:date>2015-07-07T18:30:10Z</dc:date>
    </item>
    <item>
      <title>Re: _time, calculations in transactions and mvlist</title>
      <link>https://community.splunk.com/t5/Splunk-Search/time-calculations-in-transactions-and-mvlist/m-p/196653#M56758</link>
      <description>&lt;P&gt;The fields like source, host, etc are all the same as all the data is coming from one single server. So for most of what I'm trying to do it's not relevant.  There is one field which uniquely identifies the data's origin and units, which I generalized to sensor in my code examples. &lt;/P&gt;

&lt;P&gt;The primary field of interest is Value, which contains the data from the sensor, which is always in the same format of unit/unit time. &lt;/P&gt;

&lt;P&gt;The &lt;EM&gt;time field and date&lt;/EM&gt;* fields describe the time that the data was logged. It's not a fixed rate in between points. &lt;/P&gt;

&lt;P&gt;Does that help enough? &lt;/P&gt;</description>
      <pubDate>Tue, 07 Jul 2015 19:46:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/time-calculations-in-transactions-and-mvlist/m-p/196653#M56758</guid>
      <dc:creator>ErikaE</dc:creator>
      <dc:date>2015-07-07T19:46:58Z</dc:date>
    </item>
    <item>
      <title>Re: _time, calculations in transactions and mvlist</title>
      <link>https://community.splunk.com/t5/Splunk-Search/time-calculations-in-transactions-and-mvlist/m-p/196654#M56759</link>
      <description>&lt;P&gt;I can see them as a list after the transaction command but I'm not sure how to proceed from there. So for example the first transaction (331 events)  has lines like the one below: &lt;/P&gt;

&lt;P&gt;2015-06-30 21:02:10.859 +0000 Sensor="SensorA" Value="5" Quality="good"&lt;/P&gt;

&lt;P&gt;Below that is listed: &lt;/P&gt;

&lt;P&gt;Sensor=SensorA Value = 5 Value = 6 Value = 7 Value = 8 Value = 9 Value = 10 Value = 11 Value = 12&lt;/P&gt;

&lt;P&gt;For example. &lt;/P&gt;

&lt;P&gt;The command that produced that output was: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; sensorA Value&amp;gt;# | eval time = _time | transaction maxpause=2m maxevents=-1
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Jul 2015 19:51:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/time-calculations-in-transactions-and-mvlist/m-p/196654#M56759</guid>
      <dc:creator>ErikaE</dc:creator>
      <dc:date>2015-07-07T19:51:55Z</dc:date>
    </item>
    <item>
      <title>Re: _time, calculations in transactions and mvlist</title>
      <link>https://community.splunk.com/t5/Splunk-Search/time-calculations-in-transactions-and-mvlist/m-p/196655#M56760</link>
      <description>&lt;P&gt;So you only have a single sensor then?  That seems very strange and unlikely to be a stable situation (as soon as you get something good, you are probably going to be asked to do the same thing with more sensors).  The reason I am asking is that you probably need to ditch &lt;CODE&gt;transaction&lt;/CODE&gt; and use &lt;CODE&gt;stats&lt;/CODE&gt; but we need a correlating field with which to work.  In any case, if this is all you specify, then I cannot help.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jul 2015 19:55:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/time-calculations-in-transactions-and-mvlist/m-p/196655#M56760</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-07-07T19:55:25Z</dc:date>
    </item>
    <item>
      <title>Re: _time, calculations in transactions and mvlist</title>
      <link>https://community.splunk.com/t5/Splunk-Search/time-calculations-in-transactions-and-mvlist/m-p/196656#M56761</link>
      <description>&lt;P&gt;I can see Value in the fields list but not _time. If I count _time I get a # of values equal to the number of transactions, 1 _time per transaction. &lt;/P&gt;</description>
      <pubDate>Tue, 07 Jul 2015 20:05:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/time-calculations-in-transactions-and-mvlist/m-p/196656#M56761</guid>
      <dc:creator>ErikaE</dc:creator>
      <dc:date>2015-07-07T20:05:18Z</dc:date>
    </item>
    <item>
      <title>Re: _time, calculations in transactions and mvlist</title>
      <link>https://community.splunk.com/t5/Splunk-Search/time-calculations-in-transactions-and-mvlist/m-p/196657#M56762</link>
      <description>&lt;P&gt;Did you try using the &lt;CODE&gt;time&lt;/CODE&gt; (in contrast with &lt;CODE&gt;_time&lt;/CODE&gt;) that you created with eval? You should have multiple time values PER transaction.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jul 2015 21:06:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/time-calculations-in-transactions-and-mvlist/m-p/196657#M56762</guid>
      <dc:creator>aljohnson_splun</dc:creator>
      <dc:date>2015-07-07T21:06:15Z</dc:date>
    </item>
    <item>
      <title>Re: _time, calculations in transactions and mvlist</title>
      <link>https://community.splunk.com/t5/Splunk-Search/time-calculations-in-transactions-and-mvlist/m-p/196658#M56763</link>
      <description>&lt;P&gt;Yes! Now I do! I had to go into the fields manual and manually select time there.  &lt;/P&gt;

&lt;P&gt;Is there a command that will iterate through the transactions? Now that I can see the data I should be able to do the trapezoidal sum using the time and Value data in each of the transactions.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jul 2015 21:13:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/time-calculations-in-transactions-and-mvlist/m-p/196658#M56763</guid>
      <dc:creator>ErikaE</dc:creator>
      <dc:date>2015-07-07T21:13:40Z</dc:date>
    </item>
    <item>
      <title>Re: _time, calculations in transactions and mvlist</title>
      <link>https://community.splunk.com/t5/Splunk-Search/time-calculations-in-transactions-and-mvlist/m-p/196659#M56764</link>
      <description>&lt;P&gt;Yes, after you have access to the values you need, you can iterate through all of them, which are now unique on the &lt;CODE&gt;_time&lt;/CODE&gt; field.&lt;/P&gt;

&lt;P&gt;It sounds like you really just want a sum - since you have one &lt;CODE&gt;Value&lt;/CODE&gt; value per &lt;CODE&gt;time&lt;/CODE&gt; value, right ? &lt;/P&gt;

&lt;P&gt;That would be as simple as something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | stats sum(Value) as sum by _time
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Jul 2015 21:19:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/time-calculations-in-transactions-and-mvlist/m-p/196659#M56764</guid>
      <dc:creator>aljohnson_splun</dc:creator>
      <dc:date>2015-07-07T21:19:27Z</dc:date>
    </item>
    <item>
      <title>Re: _time, calculations in transactions and mvlist</title>
      <link>https://community.splunk.com/t5/Splunk-Search/time-calculations-in-transactions-and-mvlist/m-p/196660#M56765</link>
      <description>&lt;P&gt;Can you provide a link to documentation or a use example of a correlating field?   &lt;/P&gt;

&lt;P&gt;Or an example of how stats would work when one does have a correlating field to work with?  &lt;/P&gt;</description>
      <pubDate>Tue, 07 Jul 2015 21:19:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/time-calculations-in-transactions-and-mvlist/m-p/196660#M56765</guid>
      <dc:creator>ErikaE</dc:creator>
      <dc:date>2015-07-07T21:19:37Z</dc:date>
    </item>
    <item>
      <title>Re: _time, calculations in transactions and mvlist</title>
      <link>https://community.splunk.com/t5/Splunk-Search/time-calculations-in-transactions-and-mvlist/m-p/196661#M56766</link>
      <description>&lt;P&gt;If it really has to be trapezoidal though maybe the answers you got here might help?&lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/261503/totalize-a-rate-over-time.html"&gt;https://answers.splunk.com/answers/261503/totalize-a-rate-over-time.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jul 2015 21:21:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/time-calculations-in-transactions-and-mvlist/m-p/196661#M56766</guid>
      <dc:creator>aljohnson_splun</dc:creator>
      <dc:date>2015-07-07T21:21:53Z</dc:date>
    </item>
    <item>
      <title>Re: _time, calculations in transactions and mvlist</title>
      <link>https://community.splunk.com/t5/Splunk-Search/time-calculations-in-transactions-and-mvlist/m-p/196662#M56767</link>
      <description>&lt;P&gt;edit: just saw your comment. I need more than just a sum since my data is a rate, and does not arrive at a fixed interval. If it was unit/sec and I got one event every 5 sec I could do it with a sum like you suggest,  but my data is not quite that nice. &lt;/P&gt;

&lt;P&gt;Here's the code from the other thread that acharlieh (is there a way to link usernames?) provided: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sensor | table time Value | reverse
 | streamstats last(Value) as lastValue last(time) as lastTime current=f window=1
 | eval area=(time - lastTime)*(Value+lastValue)/2
 | streamstats sum(area) as total
 | timechart span=5m max(total) as total
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'm still not quite sure how to mash these two bits of code together.  I tried starting at the streamstats command and adding a by _time&lt;/P&gt;

&lt;P&gt;like so: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sensor Value&amp;gt;# | eval time=_time |  transaction maxpause=2m maxevents=-1 
 | streamstats by _time last(Value) as lastValue last(time) as lastTime current=f window=1
 | eval area=(time - lastTime)*(Value+lastValue)/2
 | streamstats sum(area) as total
 | timechart span=5m max(total) as total
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but this generates an error Error in 'streamstats' command: Repeated group-by field 'as'.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jul 2015 21:38:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/time-calculations-in-transactions-and-mvlist/m-p/196662#M56767</guid>
      <dc:creator>ErikaE</dc:creator>
      <dc:date>2015-07-07T21:38:07Z</dc:date>
    </item>
    <item>
      <title>Re: _time, calculations in transactions and mvlist</title>
      <link>https://community.splunk.com/t5/Splunk-Search/time-calculations-in-transactions-and-mvlist/m-p/196663#M56768</link>
      <description>&lt;P&gt;I just mean how do you say which events are for which sensor.  Let's back up; what &lt;EM&gt;exactly&lt;/EM&gt; are you trying to calculate?  Are you trying to find gaps in your continuity where the sensor is not sending?  Back all the way back up and start from scratch and I am sure there is a way to do what you need &lt;EM&gt;without&lt;/EM&gt; &lt;CODE&gt;transaction&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jul 2015 21:44:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/time-calculations-in-transactions-and-mvlist/m-p/196663#M56768</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-07-07T21:44:34Z</dc:date>
    </item>
    <item>
      <title>Re: _time, calculations in transactions and mvlist</title>
      <link>https://community.splunk.com/t5/Splunk-Search/time-calculations-in-transactions-and-mvlist/m-p/196664#M56769</link>
      <description>&lt;P&gt;There is a field which identifies the sensor, like a SensorName="Sensor A Units/Unit Time". By internal convention the units are in the name of the sensor.  &lt;/P&gt;

&lt;P&gt;For now I am looking at a single sensor--still getting used to splunk. &lt;/P&gt;

&lt;P&gt;I have rate data. I am trying to calculate a total. So for ex. if my sensor was an endurance runner and then Value would a speed in m/sec, which updates while he is running. I am trying to take this speed and calculate how  far he ran.  The events are when the PLC has recorded the sensor data, and they are not evenly spaced. So I might have one event, get one 5 sec later, 4 sec later, 4 sec later, 10 sec later, etc.   &lt;/P&gt;

&lt;P&gt;I only want to count miles he ran, so I will insist that the speed is above a certain threshold before I want to consider it for totaling. &lt;/P&gt;

&lt;P&gt;The method provided (in the other thread, linked in my question) for a trapezoidal sum works great if the runner is always running during the time period of interest.  It breaks down if the runner stops. The distance total jumps up across the gap. I think I understand why that is -- you're just iterating through the table, so from the computer's perspective that time in between running is multiplied by whatever the rate was when he stopped and then added to the total.  &lt;/P&gt;

&lt;P&gt;I'm just not sure how to implement a solution that addresses that problem. &lt;/P&gt;

&lt;P&gt;Does that help? &lt;/P&gt;</description>
      <pubDate>Tue, 07 Jul 2015 22:03:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/time-calculations-in-transactions-and-mvlist/m-p/196664#M56769</guid>
      <dc:creator>ErikaE</dc:creator>
      <dc:date>2015-07-07T22:03:38Z</dc:date>
    </item>
    <item>
      <title>Re: _time, calculations in transactions and mvlist</title>
      <link>https://community.splunk.com/t5/Splunk-Search/time-calculations-in-transactions-and-mvlist/m-p/196665#M56770</link>
      <description>&lt;P&gt;@ErickaE you just add the @ sign to do an "at-mention" to link the username.&lt;BR /&gt;
The error is coming from your by-clause  in your first &lt;CODE&gt;streamstats&lt;/CODE&gt; being in the wrong place (must come at the end). &lt;/P&gt;

&lt;P&gt;I don't think the streamstats approach is going to work - because the &lt;CODE&gt;last&lt;/CODE&gt; function only returns one number per transaction (where you need it per event within the transaction). You'd need to table out the values to get them in the table format (they're in the event format when they're spit out of transaction). Then you'd need to make them single-valued rather than multivalued (transaction is pushing all those values into one field)&lt;/P&gt;

&lt;P&gt;Look at the data at this point:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; sensor Value&amp;gt;# | eval time=_time |  transaction maxpause=2m maxevents=-1 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Notice you're in the events tab.&lt;/P&gt;

&lt;P&gt;Look at the data at this point:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; sensor Value&amp;gt;# | eval time=_time |  transaction maxpause=2m maxevents=-1 
| table _time time bytes
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Notice you're in the statistics tab.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; sensor Value&amp;gt;# | eval time=_time |  transaction maxpause=2m maxevents=-1 
| table _time time bytes
| mvexpand bytes
| mvexpand time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now you're getting back to the output from that other answer... and its at this point that you could then add the streamstats (with the by at the end), eval, streamstats, and timechart.&lt;/P&gt;

&lt;P&gt;Having to do this much work though in general to get a delta &amp;amp; some simple math makes me, in addition to woodchuck, wonder if you really need to use the transaction command.&lt;/P&gt;

&lt;P&gt;Is there any other field you can group by in order to avoid having to use transaction?&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jul 2015 22:25:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/time-calculations-in-transactions-and-mvlist/m-p/196665#M56770</guid>
      <dc:creator>aljohnson_splun</dc:creator>
      <dc:date>2015-07-07T22:25:59Z</dc:date>
    </item>
  </channel>
</rss>

