<?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: use of streamstats over transaction command in Knowledge Management</title>
    <link>https://community.splunk.com/t5/Knowledge-Management/use-of-streamstats-over-transaction-command/m-p/463865#M8109</link>
    <description>&lt;PRE&gt;&lt;CODE&gt;index=yours sourcetype=yours
| eval time=strptime(time, "%m/%d/%Y %T%1N")
| reverse
| streamstats count(eval(type="2")) as sessions by source
| stats range(time) as duration by sessions
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I don't know your field extraction.&lt;BR /&gt;
let's fix it.&lt;/P&gt;</description>
    <pubDate>Fri, 03 Apr 2020 10:19:50 GMT</pubDate>
    <dc:creator>to4kawa</dc:creator>
    <dc:date>2020-04-03T10:19:50Z</dc:date>
    <item>
      <title>use of streamstats over transaction command</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/use-of-streamstats-over-transaction-command/m-p/463862#M8106</link>
      <description>&lt;P&gt;I have below sample events-&lt;BR /&gt;
type=2, time=04/03/2020 01:01:000&lt;BR /&gt;
type=3, time=04/03/2020 01:16:000&lt;BR /&gt;
type=3, time=04/03/2020 01:22:000&lt;BR /&gt;
type=2, time=04/03/2020 02:20:000&lt;BR /&gt;
type=4, time=04/03/2020 03:00:000&lt;BR /&gt;
here I want duration which startswith="type=2" and endswith="type=3 OR type=4" without using &lt;STRONG&gt;transction&lt;/STRONG&gt; command since using transaction query becomes very slow.&lt;BR /&gt;
can I achieve above using streamstats?&lt;BR /&gt;
Thanks,&lt;/P&gt;</description>
      <pubDate>Fri, 03 Apr 2020 06:25:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/use-of-streamstats-over-transaction-command/m-p/463862#M8106</guid>
      <dc:creator>ips_mandar</dc:creator>
      <dc:date>2020-04-03T06:25:46Z</dc:date>
    </item>
    <item>
      <title>Re: use of streamstats over transaction command</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/use-of-streamstats-over-transaction-command/m-p/463863#M8107</link>
      <description>&lt;P&gt;what's transaction id?&lt;BR /&gt;
and in your sample, what's the durations?&lt;/P&gt;</description>
      <pubDate>Fri, 03 Apr 2020 08:49:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/use-of-streamstats-over-transaction-command/m-p/463863#M8107</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-04-03T08:49:45Z</dc:date>
    </item>
    <item>
      <title>Re: use of streamstats over transaction command</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/use-of-streamstats-over-transaction-command/m-p/463864#M8108</link>
      <description>&lt;P&gt;transaction id is source and duration starts from type=2 until first type=3&lt;/P&gt;</description>
      <pubDate>Fri, 03 Apr 2020 10:02:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/use-of-streamstats-over-transaction-command/m-p/463864#M8108</guid>
      <dc:creator>ips_mandar</dc:creator>
      <dc:date>2020-04-03T10:02:56Z</dc:date>
    </item>
    <item>
      <title>Re: use of streamstats over transaction command</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/use-of-streamstats-over-transaction-command/m-p/463865#M8109</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;index=yours sourcetype=yours
| eval time=strptime(time, "%m/%d/%Y %T%1N")
| reverse
| streamstats count(eval(type="2")) as sessions by source
| stats range(time) as duration by sessions
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I don't know your field extraction.&lt;BR /&gt;
let's fix it.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Apr 2020 10:19:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/use-of-streamstats-over-transaction-command/m-p/463865#M8109</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-04-03T10:19:50Z</dc:date>
    </item>
    <item>
      <title>Re: use of streamstats over transaction command</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/use-of-streamstats-over-transaction-command/m-p/463866#M8110</link>
      <description>&lt;P&gt;Let me give you some brief detail-&lt;BR /&gt;
type-2 means gps connection loss and type-3 means it is gps connection restored.&lt;BR /&gt;
Now I want to know for how much duration gps was loss so start with type-2 and end with type-3.&lt;BR /&gt;
But in data type-3 may come multiple times in consecutive and similarly for type-2.&lt;BR /&gt;
and in one source those strings will multiple times and i want to calculate duration by source  and within one source there can be may gps loss happened and i want all those loss duration.&lt;BR /&gt;
Hope this helps to understand my query clearly.&lt;BR /&gt;
I have just now designed one query which will work only if I select one source in start of query but it won't be working for all source using by clause and global=false in streamstats.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|streamstats range(_time) as duration reset_after="("match(Type,\"2\")")" global=f window=2 by source
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;appreciate your help.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Apr 2020 10:38:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/use-of-streamstats-over-transaction-command/m-p/463866#M8110</guid>
      <dc:creator>ips_mandar</dc:creator>
      <dc:date>2020-04-03T10:38:10Z</dc:date>
    </item>
    <item>
      <title>Re: use of streamstats over transaction command</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/use-of-streamstats-over-transaction-command/m-p/463867#M8111</link>
      <description>&lt;P&gt;I see your situation.&lt;BR /&gt;
please provide sample log.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Apr 2020 11:22:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/use-of-streamstats-over-transaction-command/m-p/463867#M8111</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-04-03T11:22:12Z</dc:date>
    </item>
    <item>
      <title>Re: use of streamstats over transaction command</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/use-of-streamstats-over-transaction-command/m-p/463868#M8112</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Index="YouShouldAlwaysSpecifyIndex" AND sourcetype="And sourcetypeToo"
| streamstats count(eval(type="3")) AS sessionID BY source
| stats range(_time) AS duration values(type) AS type BY sessionID
| search type="2" AND type="3"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 Apr 2020 11:48:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/use-of-streamstats-over-transaction-command/m-p/463868#M8112</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2020-04-03T11:48:37Z</dc:date>
    </item>
  </channel>
</rss>

