<?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: Displaying concurrent users over time in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Displaying-concurrent-users-over-time/m-p/92494#M23866</link>
    <description>&lt;P&gt;still same result... date_hour is always the field when the session did start/end. but i need to stretch this accross the duration timeline. from start of the session until the end.&lt;/P&gt;</description>
    <pubDate>Thu, 10 Oct 2013 13:42:34 GMT</pubDate>
    <dc:creator>Matthias_BY</dc:creator>
    <dc:date>2013-10-10T13:42:34Z</dc:date>
    <item>
      <title>Displaying concurrent users over time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Displaying-concurrent-users-over-time/m-p/92490#M23862</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;i have data with VPN connectivity. Format is quite simple:&lt;/P&gt;

&lt;P&gt;1378764018782;1378764018781;OK&lt;/P&gt;

&lt;P&gt;First is Start Time of the Session - second timestamp is Ending/Stop of a Session. Both in Epoch time.&lt;/P&gt;

&lt;P&gt;I figured already out how to convert etc. all the info. so my current search gives me the results:&lt;/P&gt;

&lt;P&gt;&lt;IMG src="http://answers.splunk.com//storage/Bildschirmfoto_2013-10-10_um_14.14.04.png" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;Start                                  End                                 Concurrent      duration&lt;/P&gt;

&lt;P&gt;09/10/2013 00:00:19  09/10/2013 00:00:57     1                    38&lt;/P&gt;

&lt;P&gt;09/10/2013 00:00:19  09/10/2013 00:00:20     2                    1&lt;/P&gt;

&lt;P&gt;09/10/2013 00:00:19  09/10/2013 00:00:19     3                    0&lt;/P&gt;

&lt;P&gt;09/10/2013 00:00:23  09/10/2013 00:06:59     2                   396&lt;/P&gt;

&lt;P&gt;Search:&lt;BR /&gt;
&lt;STRONG&gt;sourcetype=vpn "OK"  | eval Start = StartTimestamp  | eval Stop = StopTimestamp  | eval Start = round(Start/1000,0)   | eval Stop = round(Stop/1000,0)  | eval Start_epoch = Start  | eval duration = (Stop-Start)  | convert ctime(Start) AS Start  | convert ctime(Stop) AS Stop  | concurrency duration=duration start=Start_epoch output=concurrent | table Start Stop concurrent duration&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Now i want to have a Report to fill this up to answer the question: how many people have been conccurrent at 12 etc. with the option to AVG per hour. i guess somehow with gentimes but i don't figured out how it is working...&lt;/P&gt;

&lt;P&gt;Result:&lt;/P&gt;

&lt;P&gt;00:00 2 Concurrent Sessions&lt;BR /&gt;
01:00 1 Concurrent Session&lt;BR /&gt;
02:00 1 &lt;BR /&gt;
03:00 1&lt;BR /&gt;
...&lt;BR /&gt;
06:00 1&lt;BR /&gt;
07:00 0&lt;/P&gt;

&lt;P&gt;thanks a lot&lt;BR /&gt;
matthias&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 14:56:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Displaying-concurrent-users-over-time/m-p/92490#M23862</guid>
      <dc:creator>Matthias_BY</dc:creator>
      <dc:date>2020-09-28T14:56:36Z</dc:date>
    </item>
    <item>
      <title>Re: Displaying concurrent users over time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Displaying-concurrent-users-over-time/m-p/92491#M23863</link>
      <description>&lt;P&gt;&lt;EM&gt;EDIT&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;Try this one:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;sourcetype=vpn "OK"|eval earliest=StartTimestamp | eval latest=StopTimestamp| streamstats count as evt_id | convert ctime(earliest) as et timeformat="%m/%d/%Y:%H:%M:%S" | convert ctime(latest) as lt timeformat="%m/%d/%Y:%H:%M:%S" | map search="|gentimes start=$et$ end=$lt$ increment=5s |eval Present=1 |eval evt_id=$evt_id$| eval _time = starttime |fields - end* start* "|fields _time Present evt_id |bin _time span=5s | timechart span=30s dc(evt_id)&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;Original&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;sourcetype=vpn "OK"  | eval Start = StartTimestamp  | eval Stop = StopTimestamp  | eval Start = round(Start/1000,0)   | eval Stop = round(Stop/1000,0)  | eval Start_epoch = Start  | eval duration = (Stop-Start)  | convert ctime(Start) AS Start  | convert ctime(Stop) AS Stop  | concurrency duration=date_hour start=Start_epoch output=concurrent | stats max(concurrent) as concurrent by date_hour&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Try this and see if it works.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2013 13:20:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Displaying-concurrent-users-over-time/m-p/92491#M23863</guid>
      <dc:creator>alacercogitatus</dc:creator>
      <dc:date>2013-10-10T13:20:03Z</dc:date>
    </item>
    <item>
      <title>Re: Displaying concurrent users over time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Displaying-concurrent-users-over-time/m-p/92492#M23864</link>
      <description>&lt;P&gt;Hi, this displays only the hours where i have an event starting:&lt;/P&gt;

&lt;P&gt;22:00     4&lt;/P&gt;

&lt;P&gt;nothing else... it does not display&lt;/P&gt;

&lt;P&gt;22:00 4&lt;BR /&gt;
23:00 1&lt;BR /&gt;
24:00 1&lt;BR /&gt;
01:00 1&lt;BR /&gt;
02:00 1&lt;BR /&gt;
...&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2013 13:30:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Displaying-concurrent-users-over-time/m-p/92492#M23864</guid>
      <dc:creator>Matthias_BY</dc:creator>
      <dc:date>2013-10-10T13:30:53Z</dc:date>
    </item>
    <item>
      <title>Re: Displaying concurrent users over time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Displaying-concurrent-users-over-time/m-p/92493#M23865</link>
      <description>&lt;P&gt;You may need to tweak the stats command. Avg perhaps?&lt;BR /&gt;
&lt;CODE&gt;stats avg(concurrent) as concurrent by date_hour | fillnull value=1 concurrent&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2013 13:35:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Displaying-concurrent-users-over-time/m-p/92493#M23865</guid>
      <dc:creator>alacercogitatus</dc:creator>
      <dc:date>2013-10-10T13:35:39Z</dc:date>
    </item>
    <item>
      <title>Re: Displaying concurrent users over time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Displaying-concurrent-users-over-time/m-p/92494#M23866</link>
      <description>&lt;P&gt;still same result... date_hour is always the field when the session did start/end. but i need to stretch this accross the duration timeline. from start of the session until the end.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2013 13:42:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Displaying-concurrent-users-over-time/m-p/92494#M23866</guid>
      <dc:creator>Matthias_BY</dc:creator>
      <dc:date>2013-10-10T13:42:34Z</dc:date>
    </item>
    <item>
      <title>Re: Displaying concurrent users over time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Displaying-concurrent-users-over-time/m-p/92495#M23867</link>
      <description>&lt;P&gt;try this: &lt;CODE&gt;|concurrency ... | fillnull value=1 concurrent | stats max(concurrent) as concurrent by date_hour&lt;/CODE&gt; You may need to fiddle with it a bit, I don't think concurrent reports 1 as a value, so you just need to fill it in where needed.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2013 13:58:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Displaying-concurrent-users-over-time/m-p/92495#M23867</guid>
      <dc:creator>alacercogitatus</dc:creator>
      <dc:date>2013-10-10T13:58:29Z</dc:date>
    </item>
    <item>
      <title>Re: Displaying concurrent users over time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Displaying-concurrent-users-over-time/m-p/92496#M23868</link>
      <description>&lt;P&gt;thanks a lot for your support so far - but it's still the same result - only one hour with all the count instead many with the evolving of the time: &lt;/P&gt;

&lt;P&gt;Time        Concurrent&lt;BR /&gt;
22:00        4&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2013 14:06:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Displaying-concurrent-users-over-time/m-p/92496#M23868</guid>
      <dc:creator>Matthias_BY</dc:creator>
      <dc:date>2013-10-10T14:06:03Z</dc:date>
    </item>
    <item>
      <title>Re: Displaying concurrent users over time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Displaying-concurrent-users-over-time/m-p/92497#M23869</link>
      <description>&lt;P&gt;Here is my version of a query to help. I use a of version of the following in my app where I am dealing with concurrent users and sessions. I had a similar type of problem a while ago (&lt;A href="https://answers.splunk.com/answers/246301/concurrent-users-per-time-bucket-from-transactions.html"&gt;https://answers.splunk.com/answers/246301/concurrent-users-per-time-bucket-from-transactions.html&lt;/A&gt;), and the following is the most reusable solution I could come up with that would also scale.&lt;/P&gt;

&lt;P&gt;Note, before you get to the &lt;CODE&gt;timechart&lt;/CODE&gt; command, the &lt;CODE&gt;_time&lt;/CODE&gt; field will be in 1-minute intervals, so you should be able to inspect the data at a much higher granularity if you want. Also, the field &lt;CODE&gt;duration2&lt;/CODE&gt; shows the amount of time per 1-minute bucket. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=vpn "OK"
| eval earliest=StartTimestamp 
| eval latest=StopTimestamp
| streamstats count as evt_id
| convert ctime(earliest) as earliest timeformat="%m/%d/%Y:%H:%M:%S" 
| convert ctime(latest) as latest timeformat="%m/%d/%Y:%H:%M:%S"
| eval duration = latest - earliest
| eval start_time_min = floor(earliest - (earliest % 60))
| eval end_time_min   = floor(latest - (latest % 60))
| eval time_bins = mvrange(start_time_min, end_time_min + 1, 60)
| mvexpand time_bins 
| eval duration2 = if(start_time_min == end_time_min, duration, if(start_time_min == time_bins, round(start_time_min + 60 - earliest, 3), if(end_time_min == time_bins, round(latest - end_time_min, 3), 60))) 
| rename time_bins as _time
| table _time duration2 evt_id
| eval _span = 60
| timechart span=1h dc(evt_id) as concurrent
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 03 Oct 2016 09:57:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Displaying-concurrent-users-over-time/m-p/92497#M23869</guid>
      <dc:creator>rjthibod</dc:creator>
      <dc:date>2016-10-03T09:57:19Z</dc:date>
    </item>
    <item>
      <title>Re: Displaying concurrent users over time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Displaying-concurrent-users-over-time/m-p/92498#M23870</link>
      <description>&lt;P&gt;Thanks. Useful SPL design patterns.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Sep 2019 10:37:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Displaying-concurrent-users-over-time/m-p/92498#M23870</guid>
      <dc:creator>plaftaric</dc:creator>
      <dc:date>2019-09-06T10:37:09Z</dc:date>
    </item>
    <item>
      <title>Re: Displaying concurrent users over time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Displaying-concurrent-users-over-time/m-p/541862#M153447</link>
      <description>&lt;P&gt;I tried this but I keep getting a message saying &lt;SPAN&gt;&amp;nbsp;"Field ' time_bins' does not exist in the data"&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Mar 2021 21:04:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Displaying-concurrent-users-over-time/m-p/541862#M153447</guid>
      <dc:creator>weetabixsplunk</dc:creator>
      <dc:date>2021-03-01T21:04:25Z</dc:date>
    </item>
  </channel>
</rss>

