<?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: Find concurrent sessions over time? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Finding-concurrent-sessions-over-time/m-p/621682#M216100</link>
    <description>&lt;P&gt;You may be better going back a step and using streamstats to keep a running total of sessions, something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval sessioncountchange=if(event="Login", 1, -1)
| streamstats sum(sessioncountchange) as sessioncount by user&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 22 Nov 2022 11:35:24 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2022-11-22T11:35:24Z</dc:date>
    <item>
      <title>Finding concurrent sessions over time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Finding-concurrent-sessions-over-time/m-p/621669#M216097</link>
      <description />
      <pubDate>Thu, 24 Nov 2022 14:48:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Finding-concurrent-sessions-over-time/m-p/621669#M216097</guid>
      <dc:creator>PrisonMike</dc:creator>
      <dc:date>2022-11-24T14:48:06Z</dc:date>
    </item>
    <item>
      <title>Re: Find concurrent sessions over time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Finding-concurrent-sessions-over-time/m-p/621682#M216100</link>
      <description>&lt;P&gt;You may be better going back a step and using streamstats to keep a running total of sessions, something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval sessioncountchange=if(event="Login", 1, -1)
| streamstats sum(sessioncountchange) as sessioncount by user&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2022 11:35:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Finding-concurrent-sessions-over-time/m-p/621682#M216100</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-11-22T11:35:24Z</dc:date>
    </item>
    <item>
      <title>Re: Find concurrent sessions over time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Finding-concurrent-sessions-over-time/m-p/621687#M216105</link>
      <description>&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Nov 2022 12:11:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Finding-concurrent-sessions-over-time/m-p/621687#M216105</guid>
      <dc:creator>PrisonMike</dc:creator>
      <dc:date>2022-11-24T12:11:36Z</dc:date>
    </item>
    <item>
      <title>Re: Find concurrent sessions over time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Finding-concurrent-sessions-over-time/m-p/621689#M216107</link>
      <description>&lt;P&gt;If you use 1 and -1, lognum becomes the count of concurrent session open for the user.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval logtype = if(EventCode="4778", 1, -1)
| eval logon_time = if(logtype=1, _time, null())
| eval logoff_time = if(logtype=-1, _time, null())&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 22 Nov 2022 12:01:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Finding-concurrent-sessions-over-time/m-p/621689#M216107</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-11-22T12:01:11Z</dc:date>
    </item>
    <item>
      <title>Re: Find concurrent sessions over time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Finding-concurrent-sessions-over-time/m-p/621690#M216108</link>
      <description>&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Nov 2022 14:34:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Finding-concurrent-sessions-over-time/m-p/621690#M216108</guid>
      <dc:creator>PrisonMike</dc:creator>
      <dc:date>2022-11-24T14:34:33Z</dc:date>
    </item>
    <item>
      <title>Re: Find concurrent sessions over time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Finding-concurrent-sessions-over-time/m-p/621694#M216110</link>
      <description>&lt;P&gt;You can't easily mix the searches - however, you could split the searches so that they have a common part&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index= …..
| stats values(EventCode) as EventCode by User _time
| eval logtype = if(EventCode="4778", 1, -1)
| eval logon_time = if(logtype=1, _time, null())
| eval logoff_time = if(logtype=-1, _time, null())
| fields _time User log*
| sort 0 _time&lt;/LI-CODE&gt;&lt;P&gt;and two chained parts&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| streamstats sum(eval(logtype==1)) as lognum by User
| stats min(logon_time) as logon_time, min(logoff_time) as logoff_time by User lognum
| eval duration = logoff_time - logon_time&lt;/LI-CODE&gt;&lt;P&gt;and&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| streamstats sum(logtype) as concurrent_users
| timechart span=1h max(concurrent_users)&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 22 Nov 2022 12:18:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Finding-concurrent-sessions-over-time/m-p/621694#M216110</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-11-22T12:18:33Z</dc:date>
    </item>
    <item>
      <title>Re: Find concurrent sessions over time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Finding-concurrent-sessions-over-time/m-p/621702#M216114</link>
      <description>&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Nov 2022 14:34:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Finding-concurrent-sessions-over-time/m-p/621702#M216114</guid>
      <dc:creator>PrisonMike</dc:creator>
      <dc:date>2022-11-24T14:34:48Z</dc:date>
    </item>
    <item>
      <title>Re: Find concurrent sessions over time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Finding-concurrent-sessions-over-time/m-p/621710#M216118</link>
      <description>&lt;P&gt;Try something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| streamstats sum(logtype) as concurrent
| bin span=1h _time
| stats max(concurrent) as concurrent by _time
| eventstats min(_time) as start
| eval hour=(_time-start)/(60*60)
| makecontinuous hour
| filldown start concurrent
| eval _time=start+(hour*60*60)&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 22 Nov 2022 14:01:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Finding-concurrent-sessions-over-time/m-p/621710#M216118</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-11-22T14:01:06Z</dc:date>
    </item>
    <item>
      <title>Re: Find concurrent sessions over time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Finding-concurrent-sessions-over-time/m-p/621715#M216119</link>
      <description>&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Nov 2022 14:35:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Finding-concurrent-sessions-over-time/m-p/621715#M216119</guid>
      <dc:creator>PrisonMike</dc:creator>
      <dc:date>2022-11-24T14:35:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to find concurrent sessions over time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Finding-concurrent-sessions-over-time/m-p/621826#M216164</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/251485"&gt;@PrisonMike&lt;/a&gt;&amp;nbsp;Given that you are able to determine login_time and logout_time for each session, you probably have some unique session_id as guidance? &amp;nbsp;You must also have some unique event_type to tell you which event is login, which event is logout. &amp;nbsp;As&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;suggested, you should step back into these contexts to look for overlap.&lt;/P&gt;&lt;P&gt;I'll use the the most literal approach, namely&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Transaction#transaction" target="_blank" rel="noopener"&gt;transaction&lt;/A&gt;. &amp;nbsp;Transaction is an expensive command. &amp;nbsp;There are many ways to avoid using this command. &amp;nbsp;But this command best illustrate the thinking.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| transaction session_id startswith="login_event" endswith="logout_event" ``` for illustration purpose only; you should construct transaction according to dataset ```
| where logout_time &amp;lt; login_time AND login_time != _time ``` within each transaction, login_time == _time ```
| timechart span=1h count&lt;/LI-CODE&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2022 09:26:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Finding-concurrent-sessions-over-time/m-p/621826#M216164</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-11-23T09:26:13Z</dc:date>
    </item>
    <item>
      <title>Re: Find concurrent sessions over time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Finding-concurrent-sessions-over-time/m-p/621831#M216166</link>
      <description>&lt;P&gt;You get minus numbers because you have open sessions at the start of your time period. The problem is that you don't know how many open sessions there are. You could go back to the correlated search you started with and count the number of sessions you have with logout but no login. Or you could determine the minimum and if less than zero add these to the counts.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| streamstats sum(logtype) as concurrent
| bin span=1h _time
| stats max(concurrent) as concurrent by _time
| eventstats min(_time) as start
| eval hour=(_time-start)/(60*60)
| makecontinuous hour
| filldown start concurrent
| eval _time=start+(hour*60*60)
| eventstats min(concurrent) as min_concurrent
| eval min_concurrent=if(min_concurrent&amp;gt;0, 0, min_concurrent)
| eval concurrent=concurrent-min_concurrent&lt;/LI-CODE&gt;&lt;P&gt;Both of these methods do not take into account sessions which start before your time period and end after your time period.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2022 09:54:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Finding-concurrent-sessions-over-time/m-p/621831#M216166</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-11-23T09:54:54Z</dc:date>
    </item>
  </channel>
</rss>

