Query to Pull out Login and LogOut History and to Find User Status

Query to Pull out Login and LogOut History and to Find User Status

Purpose 
      To generate the report which contains  Login and LogOut History of the users and to find out the user status currently.

Query 1 
Below query provides the users login and logout history of the users.
  1. SELECT au.first_name as "Technician",concat(au.FIRST_NAME,au.LAST_NAME) as "Full name", LONGTODATE(acs.OPENTIME) as "Login Time", 
  2. LONGTODATE(acs.CLOSETIME) as "Logout Time" from 
  3. aaauser au LEFT JOIN 
  4. aaalogin al on au.USER_ID = al.USER_ID 
  5. inner join aaaaccount ac on al.LOGIN_ID = ac.LOGIN_ID 
  6. left join aaaaccsession acs on ac.ACCOUNT_ID = acs.ACCOUNT_ID
  7. ORDER BY ac.ACCOUNT_ID ;


Query 2 :
 By checking the Table structure and data, can be able to find login & logout history but could not able to find status change history.  Hene below query can be used to generate the users' status currently with the status changed time. Comparison of periodically scheduled reports can provide clear analysis of users status changes.
  1. SELECT au.first_name as "Technician",concat(au.FIRST_NAME,au.LAST_NAME) as "Full name",tsd.STATUSNAME as "Current Status",LONGTODATE(tcs.EXECUTEDTIME) AS "Status changed time" from  AaaAccount aaaacc INNER JOIN aaalogin aaal ON aaaacc.LOGIN_ID=aaal.LOGIN_ID  INNER JOIN aaauser au on au.user_id=aaal.user_id INNER JOIN TechnicianStatus tcs on aaal.USER_ID=tcs.TECHNICIANID  INNER JOIN techstatusdefinition tsd ON tcs.STATUS=tsd.STATUSID;


Compatibility :
      Database : PGSQL (Tested at Build No : 13008)

                    New to ADSelfService Plus?

                      • Related Articles

                      • Query to retrieve users login and logout history and find their current status

                        REQUIREMENT: To generate a report that contains the login and logout history of users and to determine the current user status. TESTED IN: Builds 14503 (Postgres) QUERY 1: The following query provides the login and logout history of users. SELECT ...
                      • Query to Pull out Login Hours

                        Purpose        To generate the Total Login Hours per Technician.  Query : select ai as "Account ID", tn as "Technician Name ( First Name )", lh as "Login hours", LONGTODATE(llt) as "Last Login Time", ln as "Login Name", domain as "Domain", email as ...
                      • Status change from history

                        This report is used to find who changed the status To make any changes to a query, refer to the KB article below. https://pitstop.manageengine.com/support/manageengine/ShowHomePage.do#Solutions/dv/24000633501275 SELECT wo.WORKORDERID "Request ID", ...
                      • Login frequency

                        This report is used to find the Technician and Requester Login frequency. SELECT AaaUser.FIRST_NAME "Technician", MAX(AaaLogin.NAME) "LoginName", MAX(AaaContactInfo.EMAILID) "Email", MAX(AaaAccSession.USER_HOST) "IP Address", ...
                      • Query report to extract Active Technician Login and IP Address (MSSQL & PGSQL)

                        Tested in builds PGSQL (14300) or MSSQL (14306) Go to Reports- New Query Report and execute this query. select DISTINCT ac.ACCOUNT_ID as "Login Account ID", au.FIRST_NAME as "Technician Name ( First Name )", count(acs.SESSION_ID) as "Number of ...