Jira audit report

vivuu November 22, 2017

We need to provide a audit report to the management on who has accessed the Atlassian tool - Jira in the last 30 days ?

3 answers

1 vote
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 22, 2017

The audit logs in Jira can keep track of changes to user management, but they don't actually track when users last logged into the site.   For that purpose, you might have better luck trying to follow the KB Retrieve last login dates for users from the database.

You should be able to use the SQL queries on that KB in order to generate a list of users that have at least had a log in to Jira within a specific time period.   However you would need to directly access the database Jira is running on for this to work.

I hope this helps.
Andy

vivuu November 23, 2017

Can we get this done by using DB query ?

We are using MSSQL and Can you share us the query to achieve that.

DBnames


Jira_DB

Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 27, 2017

Hi Vivuu,

The KB article I linked does include MS SQL specific queries for this:  Retrieve last login dates for users from the database.

Please note that this KB has different queries to run depending on what version of Jira you're running.   If you are using Jira 6.2 or higher on MS SQL the query would look like this:

 

SELECT d.directory_name AS "Directory",
    u.user_name AS "Username",
  DATEADD(second, cast(attribute_value as bigint)/1000,{d '1970-01-01'})  AS "Last Login"
FROM dbo.cwd_user u
JOIN (
    SELECT DISTINCT child_name
    FROM dbo.cwd_membership m
    JOIN dbo.globalpermissionentry gp ON m.parent_name = gp.GROUP_ID
    WHERE gp.PERMISSION IN ('ADMINISTER', 'USE', 'SYSTEM_ADMIN')
    ) AS m ON m.child_name = u.user_name
LEFT JOIN (
    SELECT *
    FROM dbo.cwd_user_attributes ca
    WHERE attribute_name = 'login.lastLoginMillis'
    ) AS a ON a.user_id = u.ID
JOIN dbo.cwd_directory d ON u.directory_id = d.ID
ORDER BY "Last Login" DESC;

 

Andy

0 votes
vivuu November 23, 2017

Can we get this done by using DB query ?

We are using MSSQL and Can you share us the query to achieve that.

DBnames


Jira_DB

 

Jira version - 7.1.9

vivuu November 23, 2017

Jira version is 7.1.9

Craig Castle-Mead
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 25, 2017

As @Andy Heinzer stated, the statements are referenced in the KB linked in his response.

 

MSSQL is

 

SELECT cwd_user.user_name, dateadd(second,cast(cast(cwd_user_attributes.attribute_value AS nvarchar(255)) AS bigint)/1000,'19700101 00:00:00:000')
FROM cwd_user, cwd_user_attributes
WHERE cwd_user.id = cwd_user_attributes.user_id AND cwd_user_attributes.attribute_name = 'login.lastLoginMillis'

 

CCM

0 votes
Andreia Fernandes
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 22, 2017

Hello,

In the users list (site administration) you have the last time they were logged in. In the right corner of the page you have an export available

vivuu November 22, 2017

Andreia,

thanks for the suggestion. However we are not getting any option for exporting.

our jira version is 7.1.9

 

note:-we only need the reports for last 30 days

Suggest an answer

Log in or Sign up to answer