是否可以访问审计日志数据?例如如何监控活跃用户?

问题描述

我正在使用 aspnet 样板 react。

一切都按预期进行。租户、控制器,甚至 odata 控制器现在都运行良好。每个控制器为其实体写入审计数据。但我现在有兴趣访问这些审计数据。在数据库方面,数据被写入到诸如 auditLog 之类的表中,并作为每个实体表的附加列。

如何访问审计数据?收集工作正常。但不知道如何访问它并在前端显示

我的尝试像 AsyncCrudAppService

或者编写 odata 控制器不起作用。

解决方法

[AbpAuthorize(PermissionNames.Pages_Users)]
[DisableAuditing]
public class AuditLogAppService : AsyncCrudAppService<AuditLog,AuditedEntityDto<long>,long,PagedResultRequestDto,AuditedEntityDto<long>>
{
    public AuditLogAppService(
        IRepository<AuditLog,long> repository,UserManager userManager,RoleManager roleManager,IRepository<Role> roleRepository,IPasswordHasher<User> passwordHasher,IAbpSession abpSession,LogInManager logInManager)
        : base(repository)
    {

    }

    public Task<ListResultDto<AuditLog>> GetAllAudits()
    {

        object audits = Repository.GetAll();

        return Task.FromResult(new ListResultDto<AuditLog>(
            ObjectMapper.Map<List<AuditLog>>(audits).ToList()
        ));

    }
}

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...