Community

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
tom_robson
New Member

Students Login Logs Download?

Hi,

Was wondering, is there a way to get access to and download the login logs on all the students?

I know there is a place in the admin tools section that lets you search for a user and get the login logs but I need them for all students and getting them one by one would be time consuming plus you can't download the login report for that student.

Tom.

7 Replies
Stef_retired
Community Team
Community Team

Hi,  @tom_robson ​, since this is something that would customarily be done by a Canvas Admin, I've shared your question with the Canvas Admins​ group. If you're not yet a member of that group, feel free to join by clicking on the link to the group and selecting Join Group from the Actions dropdown at the upper right of the page.

kona
Community Coach
Community Coach

Due to the technical nature of this question, and that I'm pretty sure this isn't possible on the front end of Canvas, I'm going to share this with the Canvas Developers​ group to see if they can assist!

llawson
Community Contributor

Hi Tom,

This API call may be what you are looking for. It returns the students in the course with their last logon date/time stamp for when they last logged into Canvas.

GET https://school.instructure.com/api/v1/courses/:course_id/recent_students?per_page=100 
James
Community Champion

 @tom_robson ‌,

I just stumbled tonight across the Authentications Log API while looking for something else. It says it's only available if your server has configured audit logs, but I guess ours has been because it worked for me.

You can request authentication audits by login ID, account, or user ID. You can use sis_user_id or self for the user ID and self for the account ID (we don't have a SIS account ID to test that), but login ID requires the ID from the login table (the internal Canvas ID) -- despite sis_login_id being listed on the SIS IDs page as a valid substitution for login_id. That is logins/sis_login_id:james doesn't work, but logins/1234 (if that were my internal login number) would.

But if you choose the account endpoint, you can get the login information for the entire account.

There is an events array that contains an object for each login or logout. It has the created_at field for the timestamp and then a links object that contains the login ID, account ID, and user ID for the login.

Those IDs are tied to a linked object that contains arrays for logins, accounts, and users, so you can get the specific information about each one without having to make additional calls. You'll need to match the login, account, or user from the event to the respective id field in the object to find the match.

Because login/logout events are potentially being added while you're fetching the data, the headers will contain a link that contains a page=bookmark: rather than just a number like what happens most of the time. There is no rel=last, so I don't know how far back the information goes.

The query parameters include a start_time and end_time in ISO8601 format, so you could limit the searches, archive the old information, and then fetch just the new information by specifying the start_time as the last time you pulled the information.

Depending on your setup, the logout event may not be useful. I never logout as we're using CAS and tokens are valid only for the browser session (or a timeout). So, I just close the browser rather than clicking on a logout button, so there are no logout events logged for me (at least not in my last 100 logins).

Robbie_Grant
Community Coach
Community Coach

 @tom_robson ,

Were you able to find an answer to your question? I am going to go ahead and mark this question as answered because there hasn't been any more activity in a while so I assume that you have the information that you need. If you still have a question about this or if you have information that you would like to share with the community, by all means, please do come back and leave a comment.  Also, if this question has been answered by one of the previous replies, please feel free to mark that answer as correct.

 

Robbie

qnguyen
Community Contributor

Hi everyone,

I have been looking for the same solution for this, but what I need is a logs of How much time, where and what course, students have been on our Cavas portal. This is for all students and not a specific user, so it is even hard. I am very sure this issue was first brought up in 2017 and must have been a soluttion to it now. Thanks

tom_robson
New Member

Hi,

Just a update on how we get the login data for our students.

It was abit of a round about way, but we got all the page view data (Canvas LMS REST API Documentation ). In there there is a session_id, which we assume is created each time the student logs in. We grouped the session_ids together for each student then got the lowest created_at date and the highest created_at date for the session_id. Then simply found out how many minutes has passed between the to times to give us a rough time on how long the student was logged on for that given session_id. This does come with some problems, the major one being that a student could leave a page on in a tab for a day or still and still be logged in, which will cause the time calculated to be big, doesn't mean that student was doing anything.

Another thing is that you have to also save the link data that comes with the page view because in there is the real_user data which will tell you if the session_id was created by the student or a staff member acting as the student.

Doing this will also give you data that is older then a year old. However there is ALOT of data that is pulled down so I wouldn't try to pull it all down in one go. Small pieces at a time and save them to a DB or file.

Remember this is under the assumption that session_id is generated each time a student logs in.

Hope that helps.

Tom.