<?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 track state changes for RDP sessions and generate a report show durations with start and end times? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-track-state-changes-for-RDP-sessions-and-generate-a/m-p/276226#M83323</link>
    <description>&lt;P&gt;Thanks, but ... it won't work. &lt;BR /&gt;
Let's take the following scenario: Session ID 6 is Active from 01:00:00 to 01:01:00 (1 minute)&lt;BR /&gt;
It goes in Disconnect from 01:01:00 to 01:03:00 (2 minutes)&lt;BR /&gt;
It goes back to active from 01:03:00 to 01:10:00 (7 minutes).&lt;BR /&gt;
What I need is to identify the State change and somehow to measure earliest and latest time for the events until state change, and then go on.... with the rest.&lt;BR /&gt;
P.S. I already got to a similar result using streamstats, but I tried nevertheless your proposed answer, with no result ...&lt;/P&gt;</description>
    <pubDate>Thu, 10 Dec 2015 14:39:02 GMT</pubDate>
    <dc:creator>sergiupopescu</dc:creator>
    <dc:date>2015-12-10T14:39:02Z</dc:date>
    <item>
      <title>How to track state changes for RDP sessions and generate a report show durations with start and end times?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-track-state-changes-for-RDP-sessions-and-generate-a/m-p/276224#M83321</link>
      <description>&lt;P&gt;So I am looking for help, I guess I just found something I can't do with Splunk... and I know I'm wrong, only I can't prove it!&lt;BR /&gt;
It may be related to me (as I am somehow new to Splunk), so please help. Here goes:&lt;/P&gt;

&lt;P&gt;Basically, I have events like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Time     | SessionId | State
01:00:00 | 7         | Active
01:01:00 | 7         | Disconnected
01:02:00 | 7         | Disconnected
01:03:00 | 7         | Active
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What I would like is to generate a report to show actual session durations (with start time and end time), something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Session 7 | State=Active        | Start 01:00:00 | End 01:01:00
Session 7 | State=Disconnected  | Start 01:01:00 | End 01:03:00
Session 7 | State=Active        | Start 01:03:00 | End ....
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I tried  with streamstats, but no go, and unfortunately I am in a lack of ideas, so any help would be highly appreciated!&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2015 12:19:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-track-state-changes-for-RDP-sessions-and-generate-a/m-p/276224#M83321</guid>
      <dc:creator>sergiupopescu</dc:creator>
      <dc:date>2015-12-10T12:19:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to track state changes for RDP sessions and generate a report show durations with start and end times?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-track-state-changes-for-RDP-sessions-and-generate-a/m-p/276225#M83322</link>
      <description>&lt;P&gt;Try something like this (this is untested, so you will have to tweak it to get it to work)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your_search | reverse | eval ct=if(match(_raw, "Active"), 1, 0) | streamstats window=1 count(ct) as uid min(_time) as start max(_time) as end by SessionId | table _time SessionId start end State
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 10 Dec 2015 14:19:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-track-state-changes-for-RDP-sessions-and-generate-a/m-p/276225#M83322</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2015-12-10T14:19:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to track state changes for RDP sessions and generate a report show durations with start and end times?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-track-state-changes-for-RDP-sessions-and-generate-a/m-p/276226#M83323</link>
      <description>&lt;P&gt;Thanks, but ... it won't work. &lt;BR /&gt;
Let's take the following scenario: Session ID 6 is Active from 01:00:00 to 01:01:00 (1 minute)&lt;BR /&gt;
It goes in Disconnect from 01:01:00 to 01:03:00 (2 minutes)&lt;BR /&gt;
It goes back to active from 01:03:00 to 01:10:00 (7 minutes).&lt;BR /&gt;
What I need is to identify the State change and somehow to measure earliest and latest time for the events until state change, and then go on.... with the rest.&lt;BR /&gt;
P.S. I already got to a similar result using streamstats, but I tried nevertheless your proposed answer, with no result ...&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2015 14:39:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-track-state-changes-for-RDP-sessions-and-generate-a/m-p/276226#M83323</guid>
      <dc:creator>sergiupopescu</dc:creator>
      <dc:date>2015-12-10T14:39:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to track state changes for RDP sessions and generate a report show durations with start and end times?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-track-state-changes-for-RDP-sessions-and-generate-a/m-p/276227#M83324</link>
      <description>&lt;P&gt;I didn't think about the start/end for disconnected state. This should do it. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| sort sid | streamstats window=2 earliest(time) as start latest(time) as end by sid | table time sid state start end | eval end=if(end=start, strftime(now(), "%m/%d/%Y %H:%M"), end)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 10 Dec 2015 20:12:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-track-state-changes-for-RDP-sessions-and-generate-a/m-p/276227#M83324</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2015-12-10T20:12:37Z</dc:date>
    </item>
  </channel>
</rss>

