How to retrieve the last login information of the user(s) using Jira Command Line Interface(CLI)

This article explains how to retrieve the last login information of user(s) using Jira Command Line Interface (CLI).

Instructions

Use getUser action to display the user statistics, in general, using CLI action. 

To get the last login information for a user:

  • Execute the following action to display the specific user's latest login details using the name parameter:

    --action getUser --name testmk
    Data for user 'testmk'
    
    User id . . . . . . . . . . . : testmk
    User key  . . . . . . . . . . : testmk
    Full name . . . . . . . . . . : testmk
    Email . . . . . . . . . . . . : testmk@gmail.com
    Time zone . . . . . . . . . . : Asia/Kolkata
    Avatar URL  . . . . . . . . . : https://www.gravatar.com/avatar/458e5180b6b320de17b8f4bc00?d=mm&s=48
    Active  . . . . . . . . . . . : Yes
    Groups  . . . . . . . . . . . : 
      Group . . . . . . . . . . . : Clay
      Group . . . . . . . . . . . : jira-administrators
      Group . . . . . . . . . . . : jira-servicedesk-users-1
      Group . . . . . . . . . . . : jira-software-users
      Group . . . . . . . . . . . : testmk_group
    Login information . . . . . . : 
      Last  . . . . . . . . . . . : 23/Apr/20 7:22 PM
      Previous  . . . . . . . . . : 23/Apr/20 7:22 PM
      Last failed . . . . . . . . : 10/Apr/20 4:46 PM
      Count . . . . . . . . . . . : 31
      Failed count  . . . . . . . : 0
      Total failed count  . . . . : 2
  • Execute the following action to display specific user details using userId parameter:

    --action getUser --userId test2

To get the latest login information of all users:

  • Execute the following action to display the latest login information of all the users with the runFromUserList action:

    --action runFromUserList --name "@all" --common "-a getUser --userId @userId@"


To get the last login information for the current user who is executing the CLI action:

  • Execute the following action displays the logged in user's latest login details:

    --action getUser
    Data for user 'admin'
    
    User id . . . . . . . . . . . : admin
    User key  . . . . . . . . . . : admin
    Full name . . . . . . . . . . : admin
    Email . . . . . . . . . . . . : admin.1@gmail.com
    Time zone . . . . . . . . . . : Asia/Kolkata
    Avatar URL  . . . . . . . . . : https://www.gravatar.com/avatar/b65e44bc00?d=mm&s=48
    Active  . . . . . . . . . . . : Yes
    Groups  . . . . . . . . . . . : 
      Group . . . . . . . . . . . : jira-administrators
      Group . . . . . . . . . . . : jira-servicedesk-users
      Group . . . . . . . . . . . : jira-servicedesk-users-1
      Group . . . . . . . . . . . : jira-software-users
      Group . . . . . . . . . . . : jira-software-users-1
    Login information . . . . . . : 
      Last  . . . . . . . . . . . : 11/5/20 7:36 AM
      Last failed . . . . . . . . : 9/12/19 5:25 PM
      Count . . . . . . . . . . . : 2466
      Total failed count  . . . . : 1
    
    

The parameters used in the above actions are :

  • --name: Value defines the name of the user.
  • --userId: Value defines the user Id of the user.