From 15a1bc95aff1447fdf2ae1cb5340a089eafc34ca Mon Sep 17 00:00:00 2001 From: feijie Date: Wed, 11 Dec 2024 17:07:30 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E6=B7=BB=E5=8A=A0=E5=AE=A1=E8=AE=A1?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E7=9A=84=20README=20=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aspnet-core/framework/auditing/README.md | 113 +++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 aspnet-core/framework/auditing/README.md diff --git a/aspnet-core/framework/auditing/README.md b/aspnet-core/framework/auditing/README.md new file mode 100644 index 000000000..2f21293a5 --- /dev/null +++ b/aspnet-core/framework/auditing/README.md @@ -0,0 +1,113 @@ +# LINGYUN.Abp 审计模块 + +## 模块概述 + +审计模块提供了全面的日志记录和审计功能,支持多种存储方式和高度可配置的审计选项。 + +## 功能特性 + +### 核心功能 + +- 审计日志基础设施 +- 审计日志仓储接口定义 +- 审计日志管理器接口定义 +- 支持忽略特定类型的审计日志记录 + +### 存储支持 + +- EntityFrameworkCore 实现 +- Elasticsearch 实现 + +## 模块引用 + +### 核心模块 + +```csharp +[DependsOn(typeof(AbpAuditLoggingModule))] +public class YouProjectModule : AbpModule +{ + // other +} +``` + +### EntityFrameworkCore 模块 + +```csharp +[DependsOn(typeof(AbpAuditLoggingEntityFrameworkCoreModule))] +public class YouProjectModule : AbpModule +{ + // other +} +``` + +### Elasticsearch 模块 + +```csharp +[DependsOn(typeof(AbpAuditLoggingElasticsearchModule))] +public class YouProjectModule : AbpModule +{ + // other +} +``` + +## 配置选项 + +### 审计日志配置 + +```json +{ + "Auditing": { + "IsEnabled": true, // 是否启用审计日志 + "HideErrors": true, // 是否隐藏错误信息 + "IsEnabledForAnonymousUsers": true, // 是否为匿名用户启用审计日志 + "IsEnabledForGetRequests": false, // 是否为GET请求启用审计日志 + "ApplicationName": null // 应用程序名称 + } +} +``` + +### Elasticsearch 配置 + +```json +{ + "AuditLogging": { + "Elasticsearch": { + "IndexPrefix": "auditlogging" // 索引前缀 + } + } +} +``` + +## 数据库连接配置 + +```json +{ + "ConnectionStrings": { + "AbpIdentity": "Server=127.0.0.1;Database=Identity;User Id=root;Password=*", + "AbpAuditLogging": "Server=127.0.0.1;Database=AuditLogging;User Id=root;Password=*" + } +} +``` + +## 高级功能 + +### 忽略特定类型 + +默认情况下,模块会忽略以下类型的审计日志: + +- CancellationToken +- CancellationTokenSource + +你可以通过配置添加更多需要忽略的类型: + +```csharp +Configure(options => +{ + options.IgnoredTypes.AddIfNotContains(typeof(YourType)); +}); +``` + +## 特殊说明 + +- Elasticsearch 实现支持跨租户,将根据租户自动切换索引 +- EntityFrameworkCore 实现主要作为桥梁,具体实现交由 Abp 官方模块管理