CAS Statistics

42 views
Skip to first unread message

Jeremiah Garmatter

unread,
Feb 25, 2021, 2:31:34 PM2/25/21
to CAS Community
Hello,

I am looking for a way to view login statistics. Does CAS 6.2.X have a way to view how many people are logged into a specific application at a time, or rather, what services are hit to initiate the login session?

I've checked the actuators and haven't found what I'm looking for yet. I thought that /actuators/ssoSessions could provide me with the info, but I was mistaken. /ssoSessions provides the active sessions but not services authenticated to.

Ray Bon

unread,
Feb 25, 2021, 3:20:06 PM2/25/21
to cas-...@apereo.org
Jeremiah,

You can get that data from the audit log. You will of course have to collate it yourself.

Ray

On Thu, 2021-02-25 at 11:31 -0800, Jeremiah Garmatter wrote:
Notice: This message was sent from outside the University of Victoria email system. Please be cautious with links and sensitive information.

Hello,

I am looking for a way to view login statistics. Does CAS 6.2.X have a way to view how many people are logged into a specific application at a time, or rather, what services are hit to initiate the login session?

I've checked the actuators and haven't found what I'm looking for yet. I thought that /actuators/ssoSessions could provide me with the info, but I was mistaken. /ssoSessions provides the active sessions but not services authenticated to.

-- 
Ray Bon
Programmer Analyst
Development Services, University Systems

I respectfully acknowledge that my place of work is located within the ancestral, traditional and unceded territory of the Songhees, Esquimalt and WSÁNEĆ Nations.

Jeremiah Garmatter

unread,
Feb 25, 2021, 3:25:39 PM2/25/21
to CAS Community, Ray Bon
Thanks Ray,

I was afraid that would be the only way to do it. There go my hopes of being lazy. Thanks anyway!

Jeremiah Garmatter

unread,
Feb 26, 2021, 9:51:29 AM2/26/21
to CAS Community, Jeremiah Garmatter, Ray Bon
I ended up using this string of commands in case it helps someone else:

grep --no-group-separator -B 1 SERVICE_TICKET_CREATED cas_audit.log | cut -d " " -f4 | sort | uniq -c | mail -s\ "$HOSTNAME login sessions" <list of email addresses>

Brief explanation:
  1. Use grep to find when a service ticket is created within the audit log
  2. -B1 to print the line right before it, which will contain the entity ID
  3. no group separator just removes the "--" separator when "-B" is used
  4. Cut the output and take the fourth field, this will contain the serviceID (unfortunately, left with an "empty" line from the service ticket created line, still working on something to clean that up)
  5. sort the list of serviceIDs for piping to uniq
  6. uniq -c prints the service ticket count from the list of services
  7. Then do whatever you want with the output, I personally prefer an email.
Ideally, I will add a way to check when sessions are removed on a user basis, then subtract the service tickets their session generated. Also, if you host in HA, it would be beneficial to combine the individual servers into a total count.

jm

unread,
Mar 3, 2021, 2:36:54 AM3/3/21
to CAS Community, j-gar...@onu.edu, Ray Bon
You may configure your log4j2.xml (which you could specify in your cas.properties) to send "org.apereo.inspektr.audit.support" logger's output to an individual file or just send those log to som message queue (kafka etc.) and collect them to some data analysis platform (for example logstash -> ELK).
Reply all
Reply to author
Forward
0 new messages