Skip to main content

Audit Logging

Introduction

Audit Logs is a powerful feature within the DronaHQ platform that allows you to seamlessly integrate various loggers to capture events and activities from your modules, such as RunAPI. This feature enhances your ability to monitor, analyze, and manage logs efficiently. This documentation provides step-by-step instructions on how to enable and configure Audit Logging in your DronaHQ account.

DronaHQ Support following 2 types of Audit Logging -

  1. DronaHQ Managed Audit Logging (Available only on Self-hosted version)
  2. External Audit Logging

DronaHQ Managed Audit Logging

DronaHQ managed audit logging enables you to capture events and activities from your modules without any external logger setup. This can be an alternative to any external logger that one may want to set up.

info

DronaHQ Managed Audit Logging is supported only on self hosted version.

To enable this feature you need to configure this environment variable on your self-hosted environment file

DHQ_MANAGED_AUDIT_LOG_ENABLED=’true’

Once this is enabled, your audit logs will be saved in the dhq_managed_audit_log collection which will be auto-created in your configured DHQ_MONGODB_HOST server with database name DHQ_MONGODB_DATABASE. The above variables are configured while setting up self-hosted instance.

Once this is set up, go to Account Settings -> General & Security -> Audit Logging section, you will find DronaHQ managed Audit Logging is Enabled message and to View Audit logs you can click on View Audit Logs button

DHQ managed audit logging
DronaHQ managed audit log setting

Easily access and manage your audit logs with advanced filtering options, including date ranges, specific events, connectors, apps, and automation filters, and search by user email. Navigate seamlessly with pagination, ensuring efficient tracking and oversight of your logs

View audit logs
View audit logs

External Audit Logging

To enable external Audit Logging, follow these steps:

Log in to your DronaHQ account and navigate to the "Account Settings" section > "General & Security" Under the "Audit Logger" section, you will find the option to set up Audit Logging. Click on "Setup External Logging."

External logger
Audit logger

Configuring Audit Loggers

After clicking on "Setup External Logging," you will be prompted to configure the logger. Follow these steps:

Select Logger Configuration: From the dropdown menu, select the logger you want to integrate. For example, you can choose MongoDB.

Audit logger Dropdown select
Audit logger Dropdown select

Provide Connection Details: Proceed to provide the necessary connection details for the selected logger. These details may include hostnames, ports, credentials, or any other information required to establish a connection.

Create Integration: Once you have entered the correct connection details, click on the "Create Integration" button. This action will initiate the integration process.

Logger Initialization: After successfully configuring the logger, you will receive a "Logger Initialized" message. This message indicates that the integration with the selected logger has been successfully established.

Logs setup Complete
Audit Logger Setup

DronaHQ provides a feature that allows you to test custom logs, ensuring that the integration is functioning as expected. Here's how you can test custom logs:

Access Custom Log Testing: Within the Audit Logging settings, look for the "Test" button and Input will be displayed and one can enter the custom log and click on "Log" Button

Logging Custom Details: In this section, you can log specific details, such as event names, the user who is logged in, organization ID, and more. This information will be useful for monitoring and analyzing your system's activities.

By following these simple steps, you can seamlessly enable, configure, and test the Audit Logging feature in your DronaHQ account. This powerful tool allows you to efficiently manage and monitor event logs within your modules, enhancing your overall experience with the platform.

Logging Schema

Logged KeyDescription
levelinfo/error based on response
msgLogged Event Message
timeTimestamp
organization-idYour Organization Id
environmentSource Environment
user-emailuser's Email address
resource-idSubcategory Id
resource-nameSubcategory Name
resource-typeEvent Resource Type
resource-actionEvent Resource Action
parent-idMicroApp ID/Automation ID
parent-nameMicroApp Name/Automation Name
parent-typemicroapp/automation
resource-metaPayload with Muted Key
event-idEvent Identifier
sourceSource of Logged Event
user-agentUSER-AGENT
resource-group-idCategory Id

Logging Example

For External Loggers:

{
"level": "info",
"msg": "DB Connector Query Execute",
"meta":{
"time": 1698747079624,
"organization-id": "DRONA5_Team1809",
"environment": "Production",
"user-email": "test@studio.com",
"resource-id": 20253,
"resource-name": "getAuthor",
"resource-type": "mysql",
"resource-action": "runapi",
"parent-name": "Login",
"parent-type": "mysql",
"resource-meta": {
"env_id": 1,
"env_name": "Production",
},
"event-id": "db_query",
"source": "automation",
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
"resource-group-id": 6625,
}
}

Columns For Database Loggers:

idlevelmessagemetatimestamp

List of events logged and Availability

EventsEvent IDSelf HostedCloud
User Inviteduser_invited✔️✔️
User Activateduser_activated✔️✔️
User Deactivateduser_deactivated✔️✔️
User Password Resetuser_password_reset✔️✔️
User Password Forgotuser_password_forgot✔️✔️
User Updateduser_updated✔️✔️
Group Createdgroup_created✔️✔️
Admin Logged Inadmin_logged_in✔️✔️
Admin Logged Outadmin_logged_out✔️✔️
App Savedapp_saved✔️✔️
App Createdapp_created✔️✔️
App Deletedapp_deleted✔️✔️
App Publishedapp_published✔️✔️
App Unpublishedapp_unpublished✔️✔️
App Permission Updatedapp_permission_updated✔️✔️
App Config Updatedapp_config_updated✔️✔️
Template Createdtemplate_created✔️✔️
Catalog Createdcatalog_created✔️✔️
Connectors Addedconnectors_added✔️✔️
Connectors Updatedconnectors_updated✔️✔️
Connectors Deletedconnectors_deleted✔️✔️
Connectors API Addedconnectors_api_added✔️✔️
Connectors API Updatedconnectors_api_updated✔️✔️
Connectors API Deletedconnectors_api_deleted✔️✔️
Connectors Environment Updateconnectors_env_update✔️✔️
Connectors Environment Deleteconnectors_env_delete✔️✔️
Environment Addedenvironment_added✔️✔️
Environment Updatedenvironment_updated✔️✔️
Environment Deletedenvironment_deleted✔️✔️
Db Querydb_query✔️✔️
API Callapi_call✔️✔️
User Logged Inuser_logged_in✔️✔️
User Logged Outuser_logged_out✔️✔️
User Password Forgotuser_password_forgot✔️
User Password Reset Requesteduser_password_reset_requested✔️
Settings Updatedsettings_updated✔️
Public Access Enabledpublic_access_enabled✔️✔️
Public Access Disabledpublic_access_disabled✔️✔️
Organizational Access Enabledorganizational_access_enabled✔️✔️
Organizational Access Disabledorganizational_access_disabled✔️✔️
Stripe Keys Savedstripe_keys_saved✔️✔️
Automation Deletedautomation_deleted✔️✔️
Automation Enabledautomation_enabled✔️✔️
Automation Disabledautomation_disabled✔️✔️
Automation Rollbackautomation_rollback✔️✔️
Automation Publishautomation_publish✔️✔️
Automation Updatedautomation_updated✔️✔️
Automation Createdautomation_created✔️✔️
Openai Account Addedopenai_account_added✔️✔️
Openai Account Updatedopenai_account_updated✔️✔️
Openai Account Deletedopenai_account_deleted✔️✔️
Openai Account Set Defaultopenai_account_enabled✔️✔️
Email Config Createdemail_config_created✔️✔️
Email Config Savedemail_config_saved✔️✔️
Email Config Deletedemail_config_deleted✔️✔️
Email Template Savedemail_template_saved✔️✔️
SSH Key Addedssh_key_added✔️✔️
SSH Key Updatedssh_key_updated✔️✔️
SSH Key Deletedssh_key_deleted✔️✔️
SSO Enabledsso_enabled✔️✔️
SSO Disabledsso_disabled✔️✔️
SCIM User Addedscim_user_added✔️✔️
SCIM User Deactivatedscim_user_deactivated✔️
SCIM User Updatedscim_user_updated✔️
SCIM Group Addedscim_group_added✔️
SCIM Group Updatedscim_group_updated✔️
User Bulk Uploaduser_bulk_upload✔️✔️
User Bulk Deactivateduser_bulk_deactivate✔️✔️
User Bulk Activateuser_bulk_activate✔️✔️
User Group Bulk Mappingmanage_user_groups_bulk✔️✔️
New Theme Creatednew_theme_created✔️
Logger Deletedlogger_deleted✔️✔️

Note: Ensure that you provide accurate connection details for the Audit logger to ensure smooth integration.

Purging older audit logs data to free up storage

If your self-hosted MongoDB database's "dhq_managed_audit_log collection" starts accumulating too much data, it's a good practice to ease the storage burden by taking backups and removing older audit logs, generally those older than 2-3 months.