From 2f07e11a53b87a47345ce94ac02cbf8ca9af2547 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?SAL=C4=B0H=20=C3=96ZKARA?= Date: Wed, 4 Jun 2025 10:20:32 +0300 Subject: [PATCH] Update audit-logging-pro.md --- docs/en/modules/audit-logging-pro.md | 37 ++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/docs/en/modules/audit-logging-pro.md b/docs/en/modules/audit-logging-pro.md index ef609e5422..aead3a5244 100644 --- a/docs/en/modules/audit-logging-pro.md +++ b/docs/en/modules/audit-logging-pro.md @@ -9,6 +9,8 @@ This module implements the Audit Logging system of an application; * See all changes of entities and filter entity change logs. * View details of an entity change. * View all changes of an entity. +* Export audit logs and entity changes to Excel. +* Receive email notifications for completed or failed exports. * This module also defines reusable "Average Execution Duration Per Day" and "Error Rate" widgets. * Periodic clean up of audit logs. @@ -56,6 +58,10 @@ You can view details of an audit log by clicking the magnifier icon on each audi * **Actions:** This tab shows list of actions (controller actions and application service method calls with their parameters) executed during a web request. * **Changes:** This tab shows changed entities during the web request. +##### Export to Excel + +You can export audit logs to Excel by clicking the "Export to Excel" button in the toolbar. If the result set is small (less than a configurable threshold), the file will be generated and downloaded immediately. For larger result sets, the export will be processed as a background job and you'll receive an email with a download link once the export is completed. + #### Entity Changes Entity changes tab is used to list, view and filter entity change logs. @@ -80,6 +86,10 @@ You can view details of all changes of an entity by clicking the "Full Change Hi ![audit-logging-module-full-entity-change-details-modal](../images/audit-logging-module-full-entity-change-details-modal.png) +##### Export to Excel + +You can export entity changes to Excel by clicking the "Export to Excel" button in the toolbar. Similar to audit logs export, for large datasets the export will be processed as a background job and you'll receive an email notification once completed. + #### Audit Log Settings The *Audit Log* settings tab is used to configure audit log settings. You can enable or disable the clean up service system wide. This way, you can shut down the clean up service for all tenants and host. If the system wide clean up service is enabled, you can configure the global *Expired Item Deletion Period* for all tenants and host. @@ -126,6 +136,24 @@ Configure(options => The *Period* doesn't mean the *Expired Item Deletion Period*. It's the period of the worker to run clean up service system wide. The default value is 1 day. +### AuditLogExcelFileOptions + +`AuditLogExcelFileOptions` can be configured in the UI layer, within the `ConfigureServices` method of your [module](../framework/architecture/modularity/basics.md). Example: + +```csharp +Configure(options => +{ + options.FileStoragePath = "wwwroot/audit-logs"; // Default path where Excel files are stored + options.FileRetentionHours = 24; // How long to keep files before cleanup (default: 24 hours) + options.DownloadBaseUrl = "https://yourdomain.com"; // Base URL for download links in emails + options.ExcelFileCleanupOptions.Period = (int)TimeSpan.FromHours(24).TotalMilliseconds; // Interval of the cleanup worker (default: 24 hours) +}); +``` + +> Note: The `FileRetentionHours` value determines when files become eligible for deletion, but actual deletion depends on when the cleanup worker runs. If the worker hasn't run after the retention period expires, files will remain accessible. Therefore, `FileRetentionHours` represents the minimum intended retention time, but the actual retention time might be longer depending on the worker's execution schedule. + +These settings control where Excel export files are stored, how long they are kept before automatic cleanup, and what base URL is used in email download links. + ## Internals ### Domain layer @@ -156,6 +184,15 @@ Following custom repositories are defined for this module: * `AuditLogsAppService` (implements `IAuditLogsAppService`): Implements the use cases of the audit logs management UI. +#### Email Templates + +The module provides email templates for notifications: + +* `AuditLogExportCompleted`: Sent when an audit log export is successfully completed, including a download link. +* `AuditLogExportFailed`: Sent when an audit log export fails, including error details. +* `EntityChangeExportCompleted`: Sent when an entity change export is successfully completed, including a download link. +* `EntityChangeExportFailed`: Sent when an entity change export fails, including error details. + ### Database providers #### Common