Instructions
We need to:
- Explain what is the MnoEnterprise::EventLogger and how it works in mnoe (In Layman's Terms! / Business Terms)
- Present the different Listeners/Dispatcher available (MnoHub, Intercom, DIY)
- List all the events that are being logged and what metadata is logged with them (You can see a partial list here: - CR-24Getting issue details... STATUS )
A separate section needs to be about using the Mnoe API for events retrieval
- Describe the API
- Explain that we can format the display and have custom messages. See:
- https://github.com/maestrano/mno-enterprise/blob/79fb782f9cceb7cef34e6d2de80b7f5e0646aa5b/core/app/models/mno_enterprise/audit_event.rb#L14
- Example config: https://github.com/maestrano/pwc-enterprise/blob/develop/config/audit_log.yml
- Default config: https://github.com/maestrano/mno-enterprise/blob/master/core/config/initializers/audit_log.rb
The audit log is managed by an event logger provided by MnoEnterprise (MnoEnterprise::EventLogger).
1 - What is the MnoEnterprise::EventLogger?
The MnoEnterprise::EventLogger is responsible for the following:
- Processing of various actions performed by end users (eg: signing in, adding an application, etc.).
- The actions or events that the event logger tracks are pre-defined and listed in the events section below.
- Creating a notification for each event and dispatching those notifications to various listeners.
- Listeners are responsible for processing the events as they see fit.
How it works:
- A user does something that triggers a logged event.
- As the action is processed by MnoEnterprise the event logger is notified.
- Each action or event is then sent to various listeners.
- Each listener is responsible for processing the event/s as they see fit.
1.1 - Listeners
Listeners are implemented in MnoEnterprise to process the events dispatched by the MnoEnterprise::EventLogger
- Audit Events Listener
- The audit events listener creates a record or audit trail of events that can be accessed via the MnoEnterprise API.
- Intercom Events Listener
- The Intercom events listener creates intercom events.
- DIY Listeners
- Listeners can be created and added to the event logger to adopt custom behaviors.
TODO: Technical article on DIY listeners coming soon.
1.2 - Events
The following events and metadata are logged via the MnoEnterprise::EventLogger
App Events
Event | Description | Metadata |
---|---|---|
'app_add' | Application added to dashboard | { id: 2, uid: 'cld-7y9h', name: 'AccountingPro', app_nid: 'account-pro-us' } |
'app_destroy' | Application deleted from dashboard | { id: 7, uid: 'cld-89r7', name: 'DemoApplication', app_nid: 'demo-app' } |
'app_launch' | Application launched/started | { id: 4, uid: 'cld-8y7f', name: 'Inventory Tracker', app_nid: 'inv-track' } |
Dashboard Events
Event | Description | Metadata |
---|---|---|
'dashboard_create' | Dashboard created | { name: 'Sales Dashboard' } |
'dashboard_delete' | Dashboard deleted | { name: 'Sales Dashboard' } |
Organization Events
Event | Description | Metadata |
---|---|---|
'organization_create' | Organization created | { id: 4, uid: "org-fbjz", name: "abc motors" } |
'organization_destroy' | Organization deleted | { id: 4, uid: "org-fbjz", name: "Example Financial" } |
User Events
Event | Description | Metadata |
---|---|---|
'user_invite' | User invited to team/organization | { user_email: 'sample@example.com', account_name: 'Example Company' } |
'user_login' | User logged into platform | { user_name: 'John Doe', user_email: 'john.doe@example.com' } |
'user_logout' | User logged out of platform | { user_name: 'John Doe', user_email: 'john.doe@example.com' } |
'user_update' | User attributes changed | metadata contains updated user attributes { name: ['old name', 'new name'], surname: ['old name', 'new name'] } |
'user_confirm' | Confirmed user account | { user_name: 'Johnny Doe', user_email: 'JD5575@example.com' } |
'user_timeout' | User session expired | { user_name: 'Johnny Doe', user_email: 'JD5575@example.com' } |
'user_update_password' | User changed password | { user_name: 'John Doe', user_email: 'john.doe@example.com' } |
'register_developer' | User registered as a developer | { user_name: 'John Doe', user_email: 'john.doe@example.com' } |
Widget Events
Event | Description | Metadata |
---|---|---|
'widget_create' | Widget added to dashboard | { name: 'Account Balance' } |
'widget_delete' | Widget removed from dashboard | { name: 'Invoices List' } |
Events Not Currently Logged
TODO: The following events are coming soon to the Audit Log
The following events are not currently tracked by the MnoEnterprise::EventLogger
About users:
Actions not tracked:
- change of role
- users accepted invitations
- users removed from an org
About sign-up:
Information missing:
- user sign-up
- company created through sign-up
About teams:
Actions not tracked:
- team created
- team deleted
- user assigned to team
- user removed from team
- app assigned to team
- app removed from team
About apps:
Actions not tracked
- App connected to the platform
About Impac!™:
Information not tracked for Impac!
- missing name of company for all changes
- missing name of widget when it is deleted
Actions not tracked for Impac!
- there is not information for "name changed" for widgets
1.2.1 - Intercom Events
If /wiki/spaces/UKB/pages/58065026 is enabled, the MnoEnterprise::EventLogger will also create Intercom events.
NOTE: Some events are named differently when being sent to Intercom. The following table illustrates the naming differences between MnoEnterprise and Intercom.
MnoEnterprise | Intercom |
---|---|
'user_confirm' | 'finished-sign-up' |
'dashboard_create' | 'added-dashboard' |
'dashboard_delete' | 'removed-dashboard' |
'widget_delete' | 'removed-widget' |
'widget_create' | 'added-widget' |
'app_launched' | 'launched-app-{app_nid}' Ex: 'launched-app-inv-tracker' |
'app_destroy' | 'deleted-app-{app_nid}' |
'app_add' | 'added-app-{app_nid}' |
1.2.2 - Retrieving Events via the MnoHub API
MnoHub API Documentation (Audit Events)
The Audit Log can be viewed from the admin panel: (Note: The 'Description' field can be customized; See Below)
The 'Description' field can be set to display custom messages via a config file:
default: &DEFAULT events: app_add: "%{name} added" user_invite: "%{user_email} invited" dashboard_create: Dashboard '%{dashboard_name}' created dashboard_delete: Dashboard '%{dashboard_name}' deleted widget_create: Widget '%{widget_name}' added widget_delete: Widget '%{widget_name}' deleted development: <<: *DEFAULT uat: <<: *DEFAULT production: <<: *DEFAULT test: <<: *DEFAULT
The variables are the one from the event metadata.