how to create a report to get all the logged in users in the last month

amaradiswamy
Kilo Sage

Hi All,

I need to create a report whicjh should contains the users count and details logged in the last month.

could any one please advice on this.

Thanks and regards,

Swamy

1 ACCEPTED SOLUTION

Travers M
Mega Guru

If you run a report on the sys_user table, one of your filter conditions is last log in time.   Just use whatever time criteria you wanted


View solution in original post

12 REPLIES 12

Hi Naveen,



We have a field called "Last login time" on user table and it will capture the last date/time stamp when user logged in.



Thanks and regards


Swamy


Hi Swamy,



Yes i just tried out the steps u mentioned here and it worked out for me..



Thank you so much for your quick response...


Hi Travers Mohrbacher,



If i impersonate any user, then the last login time is updated as well, now i want to exclude them. How can i differentiate whether the last login time was update during user's login or during impersonation for testing purposes.



Thanks and regards,


Swamy


Honestly, I don't know that there is a way to do that on this report.   I think the only way to differentiate between an impersonate or true log in is in the systems logs


Patrick DeCarl1
ServiceNow Employee
ServiceNow Employee

Swamy,



The "last login time" won't get you the history of users who logged in last month, because the field gets updated everytime a user logs in. So if they logged in last month, then logged in today, the last login time would show today's date.



OOTB the event logs(name login) keeps track of user logins but only goes back 1 day rotation. Same with the transaction logs with url starting with /login.do however, these logs are only 7 days rotation.   See wiki link for log history. You could adjust the rotation but Highly wont recommend that.
Viewing System Logs - ServiceNow Wiki



With that said, if you need to develop this report on a monthly bases, then I would create a custom table to house all users login times so you can report history over time. Just have a new table setup and a Business rule on sys_user table to trigger with last login time changes to insert record in new custom table.