<?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: transaction that ends if a certain value changes in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/transaction-that-ends-if-a-certain-value-changes/m-p/289379#M87571</link>
    <description>&lt;P&gt;Hi, &lt;/P&gt;

&lt;P&gt;Thanks but I think the problem will resists as, the maxpause is still making sure that after 140s no event receives, a new transaction is started.&lt;/P&gt;</description>
    <pubDate>Fri, 07 Jul 2017 07:54:01 GMT</pubDate>
    <dc:creator>christianhuber</dc:creator>
    <dc:date>2017-07-07T07:54:01Z</dc:date>
    <item>
      <title>transaction that ends if a certain value changes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/transaction-that-ends-if-a-certain-value-changes/m-p/289376#M87568</link>
      <description>&lt;P&gt;Hi all, &lt;/P&gt;

&lt;P&gt;I'am sure there was already someone that had this problem and there is probably a answer right in front of me. But with all the effort reading trough splunk answer I couldn't find a proper solution. &lt;/P&gt;

&lt;P&gt;My Log file:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;12:00:00 name=SENSOR1 value=true
12:02:00 name=SENSOR1 value=true
12:03:00 name=SENSOR1 value=true
12:04:00 name=SENSOR1 value=false
12:05:00 name=SENSOR1 value=false
12:10:00 name=SENSOR1 value=false
12:11:00 name=SENSOR1 value=true
12:12:00 name=SENSOR1 value=true
12:13:00 name=SENSOR1 value=true
12:14:00 name=SENSOR1 value=true
12:15:00 name=SENSOR1 value=false
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What I would like to have as e result: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;12:00:00 name=SENSOR1 value=true duration=240
12:04:00 name=SENSOR1 value=false duration=420
12:11:00 name=SENSOR1 value=true duration=240
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My Current Search : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;value=true | transaction value, name maxpause=140s |append [search value=false | transcation value, name maxpause=140s] 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Which gives me&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;12:00:00 name=SENSOR1 value=true duration=180
12:04:00 name=SENSOR1 value=false duration=60
12:10:00 name=SENSOR1 value=false duration=0
12:11:00 name=SENSOR1 value=true duration=180
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;So I know the Problem I have is the maxpause, how can I handle that problem ?&lt;/STRONG&gt; If I'am increasing the maxpause it will combine events that shouldn't be together. But I still would like to have one event for as this is in my case one transaction, and it's possible that a sensor doesn't send regularly a status value.&lt;/P&gt;

&lt;P&gt;any help or link to a already answered question would be nice&lt;/P&gt;

&lt;P&gt;Christian &lt;/P&gt;</description>
      <pubDate>Wed, 05 Jul 2017 12:33:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/transaction-that-ends-if-a-certain-value-changes/m-p/289376#M87568</guid>
      <dc:creator>christianhuber</dc:creator>
      <dc:date>2017-07-05T12:33:09Z</dc:date>
    </item>
    <item>
      <title>Re: transaction that ends if a certain value changes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/transaction-that-ends-if-a-certain-value-changes/m-p/289377#M87569</link>
      <description>&lt;P&gt;try to use streamstats. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults |eval data="time=12:00:00 name=SENSOR1 value=true, time=12:02:00 name=SENSOR1 value=true,time=12:03:00 name=SENSOR1 value=true,time=12:04:00 name=SENSOR1 value=false,time=12:05:00 name=SENSOR1 value=false,time=12:10:00 name=SENSOR1 value=false,time=12:11:00 name=SENSOR1 value=true,time=12:12:00 name=SENSOR1 value=true,time=12:13:00 name=SENSOR1 value=true,time=12:14:00 name=SENSOR1 value=true,time=12:15:00 name=SENSOR1 value=false"|makemv data delim="," |mvexpand data|rename data as _raw|kv|convert auto(time) as _time|sort 0 - _time name|streamstats window=1 current=f values(_time) as nextTime values(value) as nextValue values(name) as nextName|sort 0 _time name|streamstats earliest(_time) as sessionTime by name value reset_on_change=t|eval duration=nextTime-_time|stats sum(duration) as duration by sessionTime
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/SplunkCloud/6.6.0/SearchReference/Streamstats"&gt;http://docs.splunk.com/Documentation/SplunkCloud/6.6.0/SearchReference/Streamstats&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;adding something along the lines of:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|sort 0 - _time name|streamstats window=1 current=f values(_time) as nextTime values(value) as nextValue values(name) as nextName|sort 0 _time name|streamstats earliest(_time) as sessionTime by name value reset_on_change=t|eval duration=nextTime-_time|stats sum(duration) as duration by sessionTime
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;might help. might need a little adjusting, though&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jul 2017 15:10:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/transaction-that-ends-if-a-certain-value-changes/m-p/289377#M87569</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2017-07-05T15:10:03Z</dc:date>
    </item>
    <item>
      <title>Re: transaction that ends if a certain value changes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/transaction-that-ends-if-a-certain-value-changes/m-p/289378#M87570</link>
      <description>&lt;P&gt;I hope it helps,&lt;/P&gt;

&lt;P&gt;your search  | eval _raw = _raw."#" | transaction value, name maxpause=140s  | eventstats values(_raw) by duration | eval _raw = split(_raw,"#")  | table _raw duration&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 14:43:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/transaction-that-ends-if-a-certain-value-changes/m-p/289378#M87570</guid>
      <dc:creator>sbbadri</dc:creator>
      <dc:date>2020-09-29T14:43:05Z</dc:date>
    </item>
    <item>
      <title>Re: transaction that ends if a certain value changes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/transaction-that-ends-if-a-certain-value-changes/m-p/289379#M87571</link>
      <description>&lt;P&gt;Hi, &lt;/P&gt;

&lt;P&gt;Thanks but I think the problem will resists as, the maxpause is still making sure that after 140s no event receives, a new transaction is started.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2017 07:54:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/transaction-that-ends-if-a-certain-value-changes/m-p/289379#M87571</guid>
      <dc:creator>christianhuber</dc:creator>
      <dc:date>2017-07-07T07:54:01Z</dc:date>
    </item>
    <item>
      <title>Re: transaction that ends if a certain value changes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/transaction-that-ends-if-a-certain-value-changes/m-p/289380#M87572</link>
      <description>&lt;P&gt;I will try this, a give feedback. At the first glance it looks pretty good for me.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2017 07:54:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/transaction-that-ends-if-a-certain-value-changes/m-p/289380#M87572</guid>
      <dc:creator>christianhuber</dc:creator>
      <dc:date>2017-07-07T07:54:36Z</dc:date>
    </item>
  </channel>
</rss>

