cancel
Showing results for 
Search instead for 
Did you mean: 

how to get last login date of user

janaka1984
Star Contributor
Star Contributor

hi ,

i need to get last logged date of current user. is there any service to access this?

regards

janaka

3 REPLIES 3

openpj
Elite Collaborator
Elite Collaborator

You have to enable the auditing engine of Alfresco to trace the login event:

Content Auditing

I think that you can follow these steps:

1. Enabled auditing by adding the following in alfresco-global.properties
audit.enabled=true
audit.alfresco-access.enabled=true
2. Start the server
3. Verify auditing is enabled with

curl -u admin:admin http://localhost:9080/alfresco/service/api/audit/contol

Below output is shown, as expected

{
"enabled" : true,
"applications":
[

{ "name": "Alfresco Tagging Service", "path" : "/tagging", "enabled" : true }

,

{ "name": "alfresco-access", "path" : "/alfresco-access", "enabled" : true }

]
}

4. List the audit entries using the following command

curl -u admin:admin http://localhost:8080/alfresco/service/api/audit/query/alfresco-access?verbose=true

Hope this helps Smiley Happy

hi

thanks for your reply.

after enable audit as you said, i could get result  as  follow.  problem is when i refresh alfresco page, that entries are filled manytimes.  this does not return correct last logged date of user.

{

  "count":21,

  "entries":

  [

  {

  "id":5,

  "application":"alfresco-access",

  "user":"admin",

  "time":"2016-10-21T13:39:25.573+05:30",

  "values":

  {

  "\/alfresco-access\/login\/user":"admin"

  }

  

  },

  {

  "id":6,

  "application":"alfresco-access",

  "user":"admin",

  "time":"2016-10-21T13:39:26.684+05:30",

  "values":

  {

  "\/alfresco-access\/transaction\/sub-actions":"readContent"

  ,"\/alfresco-access\/transaction\/action":"READ"

  ,"\/alfresco-access\/transaction\/type":"cmSmiley Tongueerson"

  ,"\/alfresco-access\/transaction\/path":"\/sys:system\/sysSmiley Tongueeople\/cm:admin"

  ,"\/alfresco-access\/transaction\/user":"admin"

  }

  

  },

cesarista
World-Class Innovator
World-Class Innovator

Hi:


As an additional comment, you can use audit-dashlet instead of curl command.

GitHub - share-extras/audit-dashlet: Display audit events for any given audit application

Regards.

--C.