Add custom logs for roles,users,groups,login #300

Merged
pahansith merged 1 commits from prathabanKavin/device-mgt-core:logger6 into master 10 months ago

Purpose

Description

Mail thread: [engineering] Creating custom loggers and Kibana dashboards

  • Added custom logs for below cases
  1. Group modification events
  2. User modification events
  3. Role modification events
  4. User login events

Log Structure

1. Role modification logs - logs for newly adding roles, updating roles and deleting roles

Pattern :
{DateTime} {LogLevel} - {ActionTag} {UserStoreDomain} {RoleName} {Users} {TenantDomain} {TenantId} {UserName} - log_message

[2023-08-11 13:05:27,812]  INFO - [ADD_ROLE] [PRIMARY] [testRole] [["admin"]] [carbon.super] [-1234] [admin]- Role testRole created 
[2023-08-11 13:05:47,512]  INFO - [UPDATE_ROLE] [PRIMARY] [testRole1] [["admin","kavin"]] [carbon.super] [-1234] [admin]- Role testRole1 updated 
[2023-08-11 13:05:54,056]  INFO - [DELETE_ROLE] [PRIMARY] [test01] [["admin","kavin"]] [carbon.super] [-1234] [admin]- Role test01 deleted 

2. User modification logs - logs for newly adding users,updating users and deleting users

Pattern :
{DateTime} {LogLevel} - {ActionTag} {UserStoreDomain} {FirstName} {LastName} {Email} {UserRoles} {TenantDomain} {TenantId} {UserName} - log_message

[2023-08-14 19:47:17,778]  INFO - [ADD_USER] [PRIMARY] [newtest] [user] [newtestuser@entgra.io] [["Internal/devicemgt-user","Internal/devicemgt-admin","admin","Internal/subscriber"]] [carbon.super] [-1234] [admin]- User newtestuser created 
[2023-08-14 19:47:32,578]  INFO - [UPDATE_USER] [PRIMARY] [Test] [User] [testUser@entgra.io] [["testRole1"]] [carbon.super] [-1234] [admin]- User PRIMARY/testUser updated 
[2023-08-14 19:47:37,659]  INFO - [REMOVE_USER] [PRIMARY] [Test] [User] [testUser@entgra.io] [["testRole1"]] [carbon.super] [-1234] [PRIMARY/testUser]- User PRIMARY/testUser removed 

3. Group modification logs /Device group assignment logs - logs for newly adding groups, updating groups, deleting groups and assigning devices to them.

Pattern :
{DateTime} {LogLevel} - {ActionTag} {GroupId} {Name} {Owner} {DeviceCount} {Devices} {TenantDomain} {TenantId} {UserName} - log_message

[2023-08-14 19:23:16,989]  INFO - [ADD_GROUP] [193] [newtestgroup] [admin] [0] [[]] [carbon.super] [-1234] [admin]- Group newtestgroup created 
[2023-08-14 19:23:37,437]  INFO - [UPDATE_GROUP] [193] [newtestgroup2] [admin] [0] [[]] [carbon.super] [-1234] [admin]- Group newtestgroup2 updated 
[2023-08-14 19:24:04,407]  INFO - [ADD_DEVICES] [193] [newtestgroup2] [admin] [1] [[{"id":1,"name":"a02","type":"android","description":"a02","deviceIdentifier":"927260cb2bf8cf43","enrolmentInfo":{"id":1,"isTransferred":false,"dateOfEnrolment":1691386566816,"dateOfLastUpdate":1691386566816,"ownership":"BYOD","status":"INACTIVE","owner":"admin"},"cost":0.0,"daysUsed":0,"deviceStatusInfo":[]}]] [carbon.super] [-1234] [admin]- Devices added for group id 193 
[2023-08-14 19:24:12,010]  INFO - [DELETE_GROUP] [193] [newtestgroup2] [admin] [1] [[{"id":1,"name":"a02","type":"android","description":"a02","deviceIdentifier":"927260cb2bf8cf43","enrolmentInfo":{"id":1,"isTransferred":false,"dateOfEnrolment":1691386566816,"dateOfLastUpdate":1691386566816,"ownership":"BYOD","status":"INACTIVE","owner":"admin"},"cost":0.0,"daysUsed":0,"deviceStatusInfo":[]}]] [carbon.super] [-1234] [admin]- Group with group id 193 deleted 

4. User login logs - logs for user logins

[2023-08-11 14:28:03,958]  INFO - [admin] [Registered] - User admin logged in 
## Purpose * Fixing https://roadmap.entgra.net/issues/10117 * Fix conflicts, improvements in https://repository.entgra.net/community/device-mgt-core/pulls/198 ## Description Mail thread: [engineering] Creating custom loggers and Kibana dashboards * Added custom logs for below cases 1. Group modification events 2. User modification events 3. Role modification events 4. User login events **Log Structure** **1. Role modification logs** - logs for newly adding roles, updating roles and deleting roles Pattern : {DateTime} {LogLevel} - {ActionTag} {UserStoreDomain} {RoleName} {Users} {TenantDomain} {TenantId} {UserName} - log_message ``` [2023-08-11 13:05:27,812] INFO - [ADD_ROLE] [PRIMARY] [testRole] [["admin"]] [carbon.super] [-1234] [admin]- Role testRole created [2023-08-11 13:05:47,512] INFO - [UPDATE_ROLE] [PRIMARY] [testRole1] [["admin","kavin"]] [carbon.super] [-1234] [admin]- Role testRole1 updated [2023-08-11 13:05:54,056] INFO - [DELETE_ROLE] [PRIMARY] [test01] [["admin","kavin"]] [carbon.super] [-1234] [admin]- Role test01 deleted ``` **2. User modification logs** - logs for newly adding users,updating users and deleting users Pattern : {DateTime} {LogLevel} - {ActionTag} {UserStoreDomain} {FirstName} {LastName} {Email} {UserRoles} {TenantDomain} {TenantId} {UserName} - log_message ``` [2023-08-14 19:47:17,778] INFO - [ADD_USER] [PRIMARY] [newtest] [user] [newtestuser@entgra.io] [["Internal/devicemgt-user","Internal/devicemgt-admin","admin","Internal/subscriber"]] [carbon.super] [-1234] [admin]- User newtestuser created [2023-08-14 19:47:32,578] INFO - [UPDATE_USER] [PRIMARY] [Test] [User] [testUser@entgra.io] [["testRole1"]] [carbon.super] [-1234] [admin]- User PRIMARY/testUser updated [2023-08-14 19:47:37,659] INFO - [REMOVE_USER] [PRIMARY] [Test] [User] [testUser@entgra.io] [["testRole1"]] [carbon.super] [-1234] [PRIMARY/testUser]- User PRIMARY/testUser removed ``` **3. Group modification logs /Device group assignment logs** - logs for newly adding groups, updating groups, deleting groups and assigning devices to them. Pattern : {DateTime} {LogLevel} - {ActionTag} {GroupId} {Name} {Owner} {DeviceCount} {Devices} {TenantDomain} {TenantId} {UserName} - log_message ``` [2023-08-14 19:23:16,989] INFO - [ADD_GROUP] [193] [newtestgroup] [admin] [0] [[]] [carbon.super] [-1234] [admin]- Group newtestgroup created [2023-08-14 19:23:37,437] INFO - [UPDATE_GROUP] [193] [newtestgroup2] [admin] [0] [[]] [carbon.super] [-1234] [admin]- Group newtestgroup2 updated [2023-08-14 19:24:04,407] INFO - [ADD_DEVICES] [193] [newtestgroup2] [admin] [1] [[{"id":1,"name":"a02","type":"android","description":"a02","deviceIdentifier":"927260cb2bf8cf43","enrolmentInfo":{"id":1,"isTransferred":false,"dateOfEnrolment":1691386566816,"dateOfLastUpdate":1691386566816,"ownership":"BYOD","status":"INACTIVE","owner":"admin"},"cost":0.0,"daysUsed":0,"deviceStatusInfo":[]}]] [carbon.super] [-1234] [admin]- Devices added for group id 193 [2023-08-14 19:24:12,010] INFO - [DELETE_GROUP] [193] [newtestgroup2] [admin] [1] [[{"id":1,"name":"a02","type":"android","description":"a02","deviceIdentifier":"927260cb2bf8cf43","enrolmentInfo":{"id":1,"isTransferred":false,"dateOfEnrolment":1691386566816,"dateOfLastUpdate":1691386566816,"ownership":"BYOD","status":"INACTIVE","owner":"admin"},"cost":0.0,"daysUsed":0,"deviceStatusInfo":[]}]] [carbon.super] [-1234] [admin]- Group with group id 193 deleted ``` **4. User login logs** - logs for user logins ``` [2023-08-11 14:28:03,958] INFO - [admin] [Registered] - User admin logged in ``` ## Related PRs * https://repository.entgra.net/proprietary/product-uem/pulls/26 * https://repository.entgra.net/proprietary/product-uem/pulls/51
prathabanKavin changed title from Add custom logs for roles,users,groups,login to WIP: Add custom logs for roles,users,groups,login 10 months ago
prathabanKavin force-pushed logger6 from b6114231cb to 2a45604527 10 months ago
prathabanKavin changed title from WIP: Add custom logs for roles,users,groups,login to Add custom logs for roles,users,groups,login 10 months ago
prathabanKavin force-pushed logger6 from 2cbe0ca556 to 654b4341e1 10 months ago
pahansith merged commit bf4a8a8f63 into master 10 months ago
The pull request has been merged as bf4a8a8f63.
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: community/device-mgt-core#300
Loading…
There is no content yet.