in reply to Re: How to Iterate to Identify Concurrent Users
in thread How to Iterate to Identify Concurrent Users

Quite simply, I would like to output the total number of concurrent users. The list is sorted since it is chronologically based. Thanks Grandfather.
  • Comment on Re^2: How to Iterate to Identify Concurrent Users

Replies are listed 'Best First'.
Re^3: How to Iterate to Identify Concurrent Users
by merlyn (Sage) on Oct 26, 2007 at 00:34 UTC
    "The total number of concurrent users" doesn't define much. If you mean "the number of users ever", then say that. If you mean "the number of users that had at least one other user logged in at the same time", that might make sense. For example, if one user logs in at 5, and leaves at 8, and another user logs in at 6, and leaves at 9, and a third user logs in from 10 to 11, how many is that? Two, or Three, or none? :)

    Or maybe you mean average users over time, which from 5 to 11 pm on that example is (calculating... 3 + 3 + 1 over 6) 2.333 or so.

      Randal,

      >if one user logs in at 5, and leaves at 8, and another user >logs in at 6, and leaves at 9, and a third user logs in from >10 to 11, how many is that? Two, or Three, or none? :)

      That would be 2, given your example. I mean the total number of simultaneous users on the system at a particular point in time. Any overlapping session of two users counts as two concurrent users. I hope this makes sense to the Greatest Monk of all ;-}

        So you mean (to quote from my earlier post) "A list indicating the number of concurrent users whenever that number changes". Something like this:

        use strict; use warnings; my @events = qw(1+ 3+ 4- 5+ 5+ 6- 6- 6- 9+ 10-); my $lastEpoch = 0; my $conections = 0; for (@events) { my ($epoch, $event) = /(\d+)(.)/; print "$lastEpoch: $conections\n" if $lastEpoch and $lastEpoch != +$epoch; $event eq '+' ? ++$conections : --$conections; $lastEpoch = $epoch; } print "$lastEpoch: $conections\n";

        Prints:

        1: 1 3: 2 4: 1 5: 3 6: 0 9: 1 10: 0

        Perl is environmentally friendly - it saves trees
Re^3: How to Iterate to Identify Concurrent Users
by ikegami (Patriarch) on Oct 26, 2007 at 00:32 UTC
    Do you mean "the maximum number of concurrent users over the span of the log file"? The total of one number is rather uninteresting, especially when you're not clear on what that number is.
      If user A logs on at 9:30 and leaves at 9:45 and user B logs at 9:40 and leaves at 10:00, that would be two concurrent/simultaneous users. I would like to capture the incremental number of concurrent users over the lifetime of the log file, as unintresting as it seems ;-) I hope this makes sense.

        that would be two concurrent/simultaneous users.

        No, that would be "two concurrent/simultaneous users between 9:40 and 9:45". Saying "x concurrent users" without specifying when makes no sense.

        Two is also the "maximum number of concurrent users between 9:30 and 10:00", and the figure I presume you want.

        You may be able to query whatever device is producing these logs in realtime over SNMP and ask it directly how many sessions are currently active. Then, you would be able to use something like RRDtool (and its Perl wrapper library) with an SNMP frontend.

        PS. incremental is confusing.