Browse Source

feat(logging): enables more accurate ES retrieval for logging

pull/448/head
cKey 4 years ago
parent
commit
dc0184f582
  1. 14
      aspnet-core/LINGYUN.MicroService.All.sln
  2. 31
      aspnet-core/modules/auditing/LINGYUN.Abp.AuditLogging.Elasticsearch/LINGYUN/Abp/AuditLogging/Elasticsearch/ElasticsearchAuditLogManager.cs
  3. 21
      aspnet-core/modules/auditing/LINGYUN.Abp.AuditLogging.Elasticsearch/LINGYUN/Abp/AuditLogging/Elasticsearch/ElasticsearchSecurityLogManager.cs
  4. 1
      aspnet-core/modules/auditing/LINGYUN.Abp.Auditing.Application.Contracts/LINGYUN/Abp/Auditing/Logging/Dto/LogFieldDto.cs
  5. 7
      aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/Hubs/MessagesHub.cs
  6. 3
      aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN.Abp.IM.csproj
  7. 4
      aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/AbpIMModule.cs
  8. 11
      aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/MessageSender.cs
  9. 3
      aspnet-core/modules/common/LINGYUN.Abp.IdGenerator/FodyWeavers.xml
  10. 30
      aspnet-core/modules/common/LINGYUN.Abp.IdGenerator/FodyWeavers.xsd
  11. 15
      aspnet-core/modules/common/LINGYUN.Abp.IdGenerator/LINGYUN.Abp.IdGenerator.csproj
  12. 17
      aspnet-core/modules/common/LINGYUN.Abp.IdGenerator/LINGYUN/Abp/IdGenerator/AbpIdGeneratorModule.cs
  13. 6
      aspnet-core/modules/common/LINGYUN.Abp.IdGenerator/LINGYUN/Abp/IdGenerator/IDistributedIdGenerator.cs
  14. 58
      aspnet-core/modules/common/LINGYUN.Abp.IdGenerator/LINGYUN/Abp/IdGenerator/Snowflake/SnowflakeIdGenerator.cs
  15. 29
      aspnet-core/modules/common/LINGYUN.Abp.IdGenerator/LINGYUN/Abp/IdGenerator/Snowflake/SnowflakeIdOptions.cs
  16. 3
      aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN.Abp.Notifications.csproj
  17. 4
      aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/AbpNotificationModule.cs
  18. 13
      aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/Internal/NotificationSender.cs
  19. 11
      aspnet-core/modules/common/LINGYUN.Abp.RealTime/LINGYUN/Abp/RealTime/AbpRealTimeModule.cs
  20. 7
      aspnet-core/modules/common/LINGYUN.Abp.RealTime/LINGYUN/Abp/RealTime/ISnowflakeIdrGenerator.cs
  21. 24
      aspnet-core/modules/common/LINGYUN.Abp.RealTime/LINGYUN/Abp/RealTime/SnowflakeIdOptions.cs
  22. 1
      aspnet-core/modules/logging/LINGYUN.Abp.Logging.Serilog.Elasticsearch/LINGYUN.Abp.Logging.Serilog.Elasticsearch.csproj
  23. 3
      aspnet-core/modules/logging/LINGYUN.Abp.Logging.Serilog.Elasticsearch/LINGYUN/Abp/AuditLogging/Serilog/Elasticsearch/AbpLoggingSerilogElasticsearchMapperProfile.cs
  24. 52
      aspnet-core/modules/logging/LINGYUN.Abp.Logging.Serilog.Elasticsearch/LINGYUN/Abp/AuditLogging/Serilog/Elasticsearch/SerilogElasticsearchLoggingManager.cs
  25. 4
      aspnet-core/modules/logging/LINGYUN.Abp.Logging.Serilog.Elasticsearch/LINGYUN/Abp/AuditLogging/Serilog/Elasticsearch/SerilogField.cs
  26. 1
      aspnet-core/modules/logging/LINGYUN.Abp.Logging/LINGYUN/Abp/AuditLogging/LogField.cs
  27. 3
      aspnet-core/modules/logging/LINGYUN.Abp.Serilog.Enrichers.UniqueId/FodyWeavers.xml
  28. 30
      aspnet-core/modules/logging/LINGYUN.Abp.Serilog.Enrichers.UniqueId/FodyWeavers.xsd
  29. 19
      aspnet-core/modules/logging/LINGYUN.Abp.Serilog.Enrichers.UniqueId/LINGYUN.Abp.Serilog.Enrichers.UniqueId.csproj
  30. 10
      aspnet-core/modules/logging/LINGYUN.Abp.Serilog.Enrichers.UniqueId/LINGYUN/Abp/Serilog/Enrichers/UniqueId/AbpSerilogEnrichersUniqueIdModule.cs
  31. 7
      aspnet-core/modules/logging/LINGYUN.Abp.Serilog.Enrichers.UniqueId/LINGYUN/Abp/Serilog/Enrichers/UniqueId/AbpSerilogUniqueIdConsts.cs
  32. 21
      aspnet-core/modules/logging/LINGYUN.Abp.Serilog.Enrichers.UniqueId/LINGYUN/Abp/Serilog/Enrichers/UniqueId/UniqueIdEnricher.cs
  33. 16
      aspnet-core/modules/logging/LINGYUN.Abp.Serilog.Enrichers.UniqueId/Serilog/UniqueIdLoggerConfigurationExtensions.cs
  34. 79
      aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/BackendAdminHttpApiHostModule.cs
  35. 1
      aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/LY.MicroService.BackendAdmin.HttpApi.Host.csproj
  36. 2
      aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/Properties/launchSettings.json
  37. 2
      aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/appsettings.json

14
aspnet-core/LINGYUN.MicroService.All.sln

@ -363,6 +363,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.DataProtection"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.DataProtection.EntityFrameworkCore", "modules\data-protection\LINGYUN.Abp.DataProtection.EntityFrameworkCore\LINGYUN.Abp.DataProtection.EntityFrameworkCore.csproj", "{19B860CA-2E1E-45CC-A5E2-ED3F2BCEAB5D}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.DataProtection.EntityFrameworkCore", "modules\data-protection\LINGYUN.Abp.DataProtection.EntityFrameworkCore\LINGYUN.Abp.DataProtection.EntityFrameworkCore.csproj", "{19B860CA-2E1E-45CC-A5E2-ED3F2BCEAB5D}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.IdGenerator", "modules\common\LINGYUN.Abp.IdGenerator\LINGYUN.Abp.IdGenerator.csproj", "{440C9BD9-85EA-4473-AB1C-7C3562DF4915}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Serilog.Enrichers.UniqueId", "modules\logging\LINGYUN.Abp.Serilog.Enrichers.UniqueId\LINGYUN.Abp.Serilog.Enrichers.UniqueId.csproj", "{23C3B247-523A-4FBF-B785-2F035E0089BD}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -941,6 +945,14 @@ Global
{19B860CA-2E1E-45CC-A5E2-ED3F2BCEAB5D}.Debug|Any CPU.Build.0 = Debug|Any CPU {19B860CA-2E1E-45CC-A5E2-ED3F2BCEAB5D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{19B860CA-2E1E-45CC-A5E2-ED3F2BCEAB5D}.Release|Any CPU.ActiveCfg = Release|Any CPU {19B860CA-2E1E-45CC-A5E2-ED3F2BCEAB5D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{19B860CA-2E1E-45CC-A5E2-ED3F2BCEAB5D}.Release|Any CPU.Build.0 = Release|Any CPU {19B860CA-2E1E-45CC-A5E2-ED3F2BCEAB5D}.Release|Any CPU.Build.0 = Release|Any CPU
{440C9BD9-85EA-4473-AB1C-7C3562DF4915}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{440C9BD9-85EA-4473-AB1C-7C3562DF4915}.Debug|Any CPU.Build.0 = Debug|Any CPU
{440C9BD9-85EA-4473-AB1C-7C3562DF4915}.Release|Any CPU.ActiveCfg = Release|Any CPU
{440C9BD9-85EA-4473-AB1C-7C3562DF4915}.Release|Any CPU.Build.0 = Release|Any CPU
{23C3B247-523A-4FBF-B785-2F035E0089BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{23C3B247-523A-4FBF-B785-2F035E0089BD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{23C3B247-523A-4FBF-B785-2F035E0089BD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{23C3B247-523A-4FBF-B785-2F035E0089BD}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@ -1120,6 +1132,8 @@ Global
{529DF802-97C4-4BF2-BE7C-39663B3D9EA3} = {C5CAD011-DF84-4914-939C-0C029DCEF26F} {529DF802-97C4-4BF2-BE7C-39663B3D9EA3} = {C5CAD011-DF84-4914-939C-0C029DCEF26F}
{BB840DEE-1F5F-45AA-A82F-4E7B7DC4F156} = {529DF802-97C4-4BF2-BE7C-39663B3D9EA3} {BB840DEE-1F5F-45AA-A82F-4E7B7DC4F156} = {529DF802-97C4-4BF2-BE7C-39663B3D9EA3}
{19B860CA-2E1E-45CC-A5E2-ED3F2BCEAB5D} = {529DF802-97C4-4BF2-BE7C-39663B3D9EA3} {19B860CA-2E1E-45CC-A5E2-ED3F2BCEAB5D} = {529DF802-97C4-4BF2-BE7C-39663B3D9EA3}
{440C9BD9-85EA-4473-AB1C-7C3562DF4915} = {8AC72641-30D3-4ACF-89FA-808FADC55C2E}
{23C3B247-523A-4FBF-B785-2F035E0089BD} = {6FC0578B-CDF1-43AD-9F7E-4AA7E4720A02}
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C95FDF91-16F2-4A8B-A4BE-0E62D1B66718} SolutionGuid = {C95FDF91-16F2-4A8B-A4BE-0E62D1B66718}

31
aspnet-core/modules/auditing/LINGYUN.Abp.AuditLogging.Elasticsearch/LINGYUN/Abp/AuditLogging/Elasticsearch/ElasticsearchAuditLogManager.cs

@ -242,51 +242,51 @@ namespace LINGYUN.Abp.AuditLogging.Elasticsearch
if (startTime.HasValue) if (startTime.HasValue)
{ {
querys.Add((log) => log.DateRange((q) => q.Field(f => f.ExecutionTime).GreaterThanOrEquals(startTime))); querys.Add((log) => log.DateRange((q) => q.Field(GetField(nameof(AuditLog.ExecutionTime))).GreaterThanOrEquals(startTime)));
} }
if (endTime.HasValue) if (endTime.HasValue)
{ {
querys.Add((log) => log.DateRange((q) => q.Field(f => f.ExecutionTime).LessThanOrEquals(endTime))); querys.Add((log) => log.DateRange((q) => q.Field(GetField(nameof(AuditLog.ExecutionTime))).LessThanOrEquals(endTime)));
} }
if (!httpMethod.IsNullOrWhiteSpace()) if (!httpMethod.IsNullOrWhiteSpace())
{ {
querys.Add((log) => log.Term((q) => q.Field(f => f.HttpMethod.Suffix("keyword")).Value(httpMethod))); querys.Add((log) => log.Term((q) => q.Field(GetField(nameof(AuditLog.HttpMethod))).Value(httpMethod)));
} }
if (!url.IsNullOrWhiteSpace()) if (!url.IsNullOrWhiteSpace())
{ {
querys.Add((log) => log.Match((q) => q.Field(f => f.Url.Suffix("keyword")).Query(url))); querys.Add((log) => log.Match((q) => q.Field(GetField(nameof(AuditLog.Url))).Query(url)));
} }
if (userId.HasValue) if (userId.HasValue)
{ {
querys.Add((log) => log.Term((q) => q.Field(f => f.UserId.Suffix("keyword")).Value(userId))); querys.Add((log) => log.Term((q) => q.Field(GetField(nameof(AuditLog.UserId))).Value(userId)));
} }
if (!userName.IsNullOrWhiteSpace()) if (!userName.IsNullOrWhiteSpace())
{ {
querys.Add((log) => log.Term((q) => q.Field(f => f.UserName.Suffix("keyword")).Value(userName))); querys.Add((log) => log.Term((q) => q.Field(GetField(nameof(AuditLog.UserName))).Value(userName)));
} }
if (!applicationName.IsNullOrWhiteSpace()) if (!applicationName.IsNullOrWhiteSpace())
{ {
querys.Add((log) => log.Term((q) => q.Field(f => f.ApplicationName.Suffix("keyword")).Value(applicationName))); querys.Add((log) => log.Term((q) => q.Field(GetField(nameof(AuditLog.ApplicationName))).Value(applicationName)));
} }
if (!correlationId.IsNullOrWhiteSpace()) if (!correlationId.IsNullOrWhiteSpace())
{ {
querys.Add((log) => log.Term((q) => q.Field(f => f.CorrelationId.Suffix("keyword")).Value(correlationId))); querys.Add((log) => log.Term((q) => q.Field(GetField(nameof(AuditLog.CorrelationId))).Value(correlationId)));
} }
if (!clientId.IsNullOrWhiteSpace()) if (!clientId.IsNullOrWhiteSpace())
{ {
querys.Add((log) => log.Term((q) => q.Field(f => f.ClientId.Suffix("keyword")).Value(clientId))); querys.Add((log) => log.Term((q) => q.Field(GetField(nameof(AuditLog.ClientId))).Value(clientId)));
} }
if (!clientIpAddress.IsNullOrWhiteSpace()) if (!clientIpAddress.IsNullOrWhiteSpace())
{ {
querys.Add((log) => log.Term((q) => q.Field(f => f.ClientIpAddress.Suffix("keyword")).Value(clientIpAddress))); querys.Add((log) => log.Term((q) => q.Field(GetField(nameof(AuditLog.ClientIpAddress))).Value(clientIpAddress)));
} }
if (maxExecutionDuration.HasValue) if (maxExecutionDuration.HasValue)
{ {
querys.Add((log) => log.Range((q) => q.Field(f => f.ExecutionDuration).LessThanOrEquals(maxExecutionDuration))); querys.Add((log) => log.Range((q) => q.Field(GetField(nameof(AuditLog.ExecutionDuration))).LessThanOrEquals(maxExecutionDuration)));
} }
if (minExecutionDuration.HasValue) if (minExecutionDuration.HasValue)
{ {
querys.Add((log) => log.Range((q) => q.Field(f => f.ExecutionDuration).GreaterThanOrEquals(minExecutionDuration))); querys.Add((log) => log.Range((q) => q.Field(GetField(nameof(AuditLog.ExecutionDuration))).GreaterThanOrEquals(minExecutionDuration)));
} }
@ -317,7 +317,7 @@ namespace LINGYUN.Abp.AuditLogging.Elasticsearch
if (httpStatusCode.HasValue) if (httpStatusCode.HasValue)
{ {
querys.Add((log) => log.Term((q) => q.Field(f => f.HttpStatusCode).Value(httpStatusCode))); querys.Add((log) => log.Term((q) => q.Field(GetField(nameof(AuditLog.HttpStatusCode))).Value(httpStatusCode)));
} }
return querys; return querys;
@ -344,7 +344,10 @@ namespace LINGYUN.Abp.AuditLogging.Elasticsearch
{ "CorrelationId", "CorrelationId.keyword" }, { "CorrelationId", "CorrelationId.keyword" },
{ "BrowserInfo", "BrowserInfo.keyword" }, { "BrowserInfo", "BrowserInfo.keyword" },
{ "HttpMethod", "HttpMethod.keyword" }, { "HttpMethod", "HttpMethod.keyword" },
{ "Url", "Url.keyword" } { "Url", "Url.keyword" },
{ "ExecutionDuration", "ExecutionDuration" },
{ "ExecutionTime", "ExecutionTime" },
{ "HttpStatusCode", "HttpStatusCode" },
}; };
protected virtual string GetField(string field) protected virtual string GetField(string field)
{ {

21
aspnet-core/modules/auditing/LINGYUN.Abp.AuditLogging.Elasticsearch/LINGYUN/Abp/AuditLogging/Elasticsearch/ElasticsearchSecurityLogManager.cs

@ -192,43 +192,43 @@ namespace LINGYUN.Abp.AuditLogging.Elasticsearch
if (startTime.HasValue) if (startTime.HasValue)
{ {
querys.Add((log) => log.DateRange((q) => q.Field(f => f.CreationTime).GreaterThanOrEquals(startTime))); querys.Add((log) => log.DateRange((q) => q.Field(GetField(nameof(SecurityLog.CreationTime))).GreaterThanOrEquals(startTime)));
} }
if (endTime.HasValue) if (endTime.HasValue)
{ {
querys.Add((log) => log.DateRange((q) => q.Field(f => f.CreationTime).LessThanOrEquals(endTime))); querys.Add((log) => log.DateRange((q) => q.Field(GetField(nameof(SecurityLog.CreationTime))).LessThanOrEquals(endTime)));
} }
if (!applicationName.IsNullOrWhiteSpace()) if (!applicationName.IsNullOrWhiteSpace())
{ {
querys.Add((log) => log.Term((q) => q.Field(f => f.ApplicationName.Suffix("keyword")).Value(applicationName))); querys.Add((log) => log.Term((q) => q.Field(GetField(nameof(SecurityLog.ApplicationName))).Value(applicationName)));
} }
if (!identity.IsNullOrWhiteSpace()) if (!identity.IsNullOrWhiteSpace())
{ {
querys.Add((log) => log.Term((q) => q.Field(f => f.Identity.Suffix("keyword")).Value(identity))); querys.Add((log) => log.Term((q) => q.Field(GetField(nameof(SecurityLog.Identity))).Value(identity)));
} }
if (!action.IsNullOrWhiteSpace()) if (!action.IsNullOrWhiteSpace())
{ {
querys.Add((log) => log.Term((q) => q.Field(f => f.Action.Suffix("keyword")).Value(action))); querys.Add((log) => log.Term((q) => q.Field(GetField(nameof(SecurityLog.Action))).Value(action)));
} }
if (userId.HasValue) if (userId.HasValue)
{ {
querys.Add((log) => log.Term((q) => q.Field(f => f.UserId.Suffix("keyword")).Value(userId))); querys.Add((log) => log.Term((q) => q.Field(GetField(nameof(SecurityLog.UserId))).Value(userId)));
} }
if (!userName.IsNullOrWhiteSpace()) if (!userName.IsNullOrWhiteSpace())
{ {
querys.Add((log) => log.Term((q) => q.Field(f => f.UserName.Suffix("keyword")).Value(userName))); querys.Add((log) => log.Term((q) => q.Field(GetField(nameof(SecurityLog.UserName))).Value(userName)));
} }
if (!clientId.IsNullOrWhiteSpace()) if (!clientId.IsNullOrWhiteSpace())
{ {
querys.Add((log) => log.Term((q) => q.Field(f => f.ClientId.Suffix("keyword")).Value(clientId))); querys.Add((log) => log.Term((q) => q.Field(GetField(nameof(SecurityLog.ClientId))).Value(clientId)));
} }
if (!clientIpAddress.IsNullOrWhiteSpace()) if (!clientIpAddress.IsNullOrWhiteSpace())
{ {
querys.Add((log) => log.Term((q) => q.Field(f => f.ClientIpAddress.Suffix("keyword")).Value(clientIpAddress))); querys.Add((log) => log.Term((q) => q.Field(GetField(nameof(SecurityLog.ClientIpAddress))).Value(clientIpAddress)));
} }
if (!correlationId.IsNullOrWhiteSpace()) if (!correlationId.IsNullOrWhiteSpace())
{ {
querys.Add((log) => log.Term((q) => q.Field(f => f.CorrelationId.Suffix("keyword")).Value(correlationId))); querys.Add((log) => log.Term((q) => q.Field(GetField(nameof(SecurityLog.CorrelationId))).Value(correlationId)));
} }
return querys; return querys;
@ -253,6 +253,7 @@ namespace LINGYUN.Abp.AuditLogging.Elasticsearch
{ "ClientIpAddress", "ClientIpAddress.keyword" }, { "ClientIpAddress", "ClientIpAddress.keyword" },
{ "ClientId", "ClientId.keyword" }, { "ClientId", "ClientId.keyword" },
{ "CorrelationId", "CorrelationId.keyword" }, { "CorrelationId", "CorrelationId.keyword" },
{ "CreationTime", "CreationTime" },
}; };
protected virtual string GetField(string field) protected virtual string GetField(string field)
{ {

1
aspnet-core/modules/auditing/LINGYUN.Abp.Auditing.Application.Contracts/LINGYUN/Abp/Auditing/Logging/Dto/LogFieldDto.cs

@ -2,6 +2,7 @@
{ {
public class LogFieldDto public class LogFieldDto
{ {
public string Id { get; set; }
public string MachineName { get; set; } public string MachineName { get; set; }
public string Environment { get; set; } public string Environment { get; set; }
public string Application { get; set; } public string Application { get; set; }

7
aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/Hubs/MessagesHub.cs

@ -1,4 +1,5 @@
using LINGYUN.Abp.IM.Contract; using LINGYUN.Abp.IdGenerator;
using LINGYUN.Abp.IM.Contract;
using LINGYUN.Abp.IM.Groups; using LINGYUN.Abp.IM.Groups;
using LINGYUN.Abp.IM.Localization; using LINGYUN.Abp.IM.Localization;
using LINGYUN.Abp.IM.Messages; using LINGYUN.Abp.IM.Messages;
@ -28,7 +29,7 @@ namespace LINGYUN.Abp.IM.SignalR.Hubs
protected IUserOnlineChanger OnlineChanger => LazyServiceProvider.LazyGetService<IUserOnlineChanger>(); protected IUserOnlineChanger OnlineChanger => LazyServiceProvider.LazyGetService<IUserOnlineChanger>();
protected ISnowflakeIdrGenerator SnowflakeIdrGenerator => LazyServiceProvider.LazyGetRequiredService<ISnowflakeIdrGenerator>(); protected IDistributedIdGenerator DistributedIdGenerator => LazyServiceProvider.LazyGetRequiredService<IDistributedIdGenerator>();
protected IExceptionToErrorInfoConverter ErrorInfoConverter => LazyServiceProvider.LazyGetRequiredService<IExceptionToErrorInfoConverter>(); protected IExceptionToErrorInfoConverter ErrorInfoConverter => LazyServiceProvider.LazyGetRequiredService<IExceptionToErrorInfoConverter>();
@ -147,7 +148,7 @@ namespace LINGYUN.Abp.IM.SignalR.Hubs
try try
{ {
chatMessage.SetProperty(nameof(ChatMessage.IsAnonymous), chatMessage.IsAnonymous); chatMessage.SetProperty(nameof(ChatMessage.IsAnonymous), chatMessage.IsAnonymous);
chatMessage.MessageId = SnowflakeIdrGenerator.Create().ToString(); chatMessage.MessageId = DistributedIdGenerator.Create().ToString();
await MessageStore.StoreMessageAsync(chatMessage); await MessageStore.StoreMessageAsync(chatMessage);
if (!chatMessage.GroupId.IsNullOrWhiteSpace()) if (!chatMessage.GroupId.IsNullOrWhiteSpace())

3
aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN.Abp.IM.csproj

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\configureawait.props" /> <Import Project="..\..\..\configureawait.props" />
<Import Project="..\..\..\common.props" /> <Import Project="..\..\..\common.props" />
@ -22,6 +22,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\LINGYUN.Abp.IdGenerator\LINGYUN.Abp.IdGenerator.csproj" />
<ProjectReference Include="..\LINGYUN.Abp.RealTime\LINGYUN.Abp.RealTime.csproj" /> <ProjectReference Include="..\LINGYUN.Abp.RealTime\LINGYUN.Abp.RealTime.csproj" />
</ItemGroup> </ItemGroup>

4
aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/AbpIMModule.cs

@ -1,5 +1,6 @@
using LINGYUN.Abp.IM.Localization; using LINGYUN.Abp.IM.Localization;
using LINGYUN.Abp.RealTime; using LINGYUN.Abp.RealTime;
using LINGYUN.Abp.IdGenerator;
using Volo.Abp.EventBus; using Volo.Abp.EventBus;
using Volo.Abp.Localization; using Volo.Abp.Localization;
using Volo.Abp.Modularity; using Volo.Abp.Modularity;
@ -10,7 +11,8 @@ namespace LINGYUN.Abp.IM
[DependsOn( [DependsOn(
typeof(AbpEventBusModule), typeof(AbpEventBusModule),
typeof(AbpRealTimeModule), typeof(AbpRealTimeModule),
typeof(AbpLocalizationModule))] typeof(AbpLocalizationModule),
typeof(AbpIdGeneratorModule))]
public class AbpIMModule : AbpModule public class AbpIMModule : AbpModule
{ {
public override void ConfigureServices(ServiceConfigurationContext context) public override void ConfigureServices(ServiceConfigurationContext context)

11
aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/MessageSender.cs

@ -1,4 +1,5 @@
using LINGYUN.Abp.RealTime; using LINGYUN.Abp.IdGenerator;
using LINGYUN.Abp.RealTime;
using System.Threading.Tasks; using System.Threading.Tasks;
using Volo.Abp.Data; using Volo.Abp.Data;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
@ -9,19 +10,19 @@ namespace LINGYUN.Abp.IM.Messages
public class MessageSender : IMessageSender, ITransientDependency public class MessageSender : IMessageSender, ITransientDependency
{ {
protected IDistributedEventBus EventBus { get; } protected IDistributedEventBus EventBus { get; }
protected ISnowflakeIdrGenerator SnowflakeIdrGenerator { get; } protected IDistributedIdGenerator DistributedIdGenerator { get; }
public MessageSender( public MessageSender(
IDistributedEventBus eventBus, IDistributedEventBus eventBus,
ISnowflakeIdrGenerator snowflakeIdrGenerator) IDistributedIdGenerator distributedIdGenerator)
{ {
EventBus = eventBus; EventBus = eventBus;
SnowflakeIdrGenerator = snowflakeIdrGenerator; DistributedIdGenerator = distributedIdGenerator;
} }
public virtual async Task<string> SendMessageAsync(ChatMessage chatMessage) public virtual async Task<string> SendMessageAsync(ChatMessage chatMessage)
{ {
chatMessage.SetProperty(nameof(ChatMessage.IsAnonymous), chatMessage.IsAnonymous); chatMessage.SetProperty(nameof(ChatMessage.IsAnonymous), chatMessage.IsAnonymous);
chatMessage.MessageId = SnowflakeIdrGenerator.Create().ToString(); chatMessage.MessageId = DistributedIdGenerator.Create().ToString();
// 如果先存储的话,就紧耦合消息处理模块了 // 如果先存储的话,就紧耦合消息处理模块了
// await Store.StoreMessageAsync(chatMessage); // await Store.StoreMessageAsync(chatMessage);
var eto = new RealTimeEto<ChatMessage>(chatMessage); var eto = new RealTimeEto<ChatMessage>(chatMessage);

3
aspnet-core/modules/common/LINGYUN.Abp.IdGenerator/FodyWeavers.xml

@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ConfigureAwait ContinueOnCapturedContext="false" />
</Weavers>

30
aspnet-core/modules/common/LINGYUN.Abp.IdGenerator/FodyWeavers.xsd

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" />
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>

15
aspnet-core/modules/common/LINGYUN.Abp.IdGenerator/LINGYUN.Abp.IdGenerator.csproj

@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\configureawait.props" />
<Import Project="..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace />
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Core" Version="$(VoloAbpPackageVersion)" />
</ItemGroup>
</Project>

17
aspnet-core/modules/common/LINGYUN.Abp.IdGenerator/LINGYUN/Abp/IdGenerator/AbpIdGeneratorModule.cs

@ -0,0 +1,17 @@
using LINGYUN.Abp.IdGenerator.Snowflake;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Volo.Abp.Modularity;
namespace LINGYUN.Abp.IdGenerator;
public class AbpIdGeneratorModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
var snowflakeIdOptions = new SnowflakeIdOptions();
context.Services.ExecutePreConfiguredActions(snowflakeIdOptions);
context.Services.TryAddSingleton<IDistributedIdGenerator>(SnowflakeIdGenerator.Create(snowflakeIdOptions));
}
}

6
aspnet-core/modules/common/LINGYUN.Abp.IdGenerator/LINGYUN/Abp/IdGenerator/IDistributedIdGenerator.cs

@ -0,0 +1,6 @@
namespace LINGYUN.Abp.IdGenerator;
public interface IDistributedIdGenerator
{
long Create();
}

58
aspnet-core/modules/common/LINGYUN.Abp.RealTime/LINGYUN/Abp/RealTime/SnowflakeIdrGenerator.cs → aspnet-core/modules/common/LINGYUN.Abp.IdGenerator/LINGYUN/Abp/IdGenerator/Snowflake/SnowflakeIdGenerator.cs

@ -1,13 +1,11 @@
using Microsoft.Extensions.Options; using System;
using System;
using Volo.Abp; using Volo.Abp;
using Volo.Abp.DependencyInjection;
namespace LINGYUN.Abp.RealTime namespace LINGYUN.Abp.IdGenerator.Snowflake
{ {
// reference: https://github.com/dotnetcore/CAP // reference: https://github.com/dotnetcore/CAP
// reference: https://blog.csdn.net/lq18050010830/article/details/89845790 // reference: https://blog.csdn.net/lq18050010830/article/details/89845790
public class SnowflakeIdrGenerator : ISnowflakeIdrGenerator, ISingletonDependency public class SnowflakeIdGenerator : IDistributedIdGenerator
{ {
public const long Twepoch = 1288834974657L; public const long Twepoch = 1288834974657L;
@ -22,48 +20,48 @@ namespace LINGYUN.Abp.RealTime
protected int TimestampLeftShift { get; } protected int TimestampLeftShift { get; }
protected long SequenceMask { get; } protected long SequenceMask { get; }
protected SnowflakeIdOptions Options { get; } private SnowflakeIdGenerator(SnowflakeIdOptions options)
public SnowflakeIdrGenerator(IOptions<SnowflakeIdOptions> options)
{ {
Options = options.Value; WorkerIdShift = options.SequenceBits;
DatacenterIdShift = options.SequenceBits + options.WorkerIdBits;
WorkerIdShift = Options.SequenceBits; TimestampLeftShift = options.SequenceBits + options.WorkerIdBits + options.DatacenterIdBits;
DatacenterIdShift = Options.SequenceBits + Options.WorkerIdBits; SequenceMask = -1L ^ (-1L << options.SequenceBits);
TimestampLeftShift = Options.SequenceBits + Options.WorkerIdBits + Options.DatacenterIdBits;
SequenceMask = -1L ^ (-1L << Options.SequenceBits);
} }
internal void Initialize(long sequence = 0L) public static SnowflakeIdGenerator Create(SnowflakeIdOptions options)
{ {
Sequence = sequence; var idGenerator = new SnowflakeIdGenerator(options)
MaxWorkerId = -1L ^ (-1L << Options.WorkerIdBits); {
MaxDatacenterId = -1L ^ (-1L << Options.DatacenterIdBits); Sequence = options.Sequence,
MaxWorkerId = -1L ^ (-1L << options.WorkerIdBits),
MaxDatacenterId = -1L ^ (-1L << options.DatacenterIdBits)
};
if (!int.TryParse(Environment.GetEnvironmentVariable("WORKERID", EnvironmentVariableTarget.Machine), out var workerId)) if (!int.TryParse(Environment.GetEnvironmentVariable("WORKERID", EnvironmentVariableTarget.Machine), out var workerId))
{ {
workerId = RandomHelper.GetRandom((int)MaxWorkerId); workerId = RandomHelper.GetRandom((int)idGenerator.MaxWorkerId);
} }
if (!int.TryParse(Environment.GetEnvironmentVariable("DATACENTERID", EnvironmentVariableTarget.Machine), out var datacenterId)) if (!int.TryParse(Environment.GetEnvironmentVariable("DATACENTERID", EnvironmentVariableTarget.Machine), out var datacenterId))
{ {
datacenterId = RandomHelper.GetRandom((int)MaxDatacenterId); datacenterId = RandomHelper.GetRandom((int)idGenerator.MaxDatacenterId);
} }
if (workerId > MaxWorkerId || workerId < 0) if (workerId > idGenerator.MaxWorkerId || workerId < 0)
throw new ArgumentException($"worker Id can't be greater than {MaxWorkerId} or less than 0"); throw new ArgumentException($"worker Id can't be greater than {idGenerator.MaxWorkerId} or less than 0");
if (datacenterId > MaxDatacenterId || datacenterId < 0) if (datacenterId > idGenerator.MaxDatacenterId || datacenterId < 0)
throw new ArgumentException($"datacenter Id can't be greater than {MaxDatacenterId} or less than 0"); throw new ArgumentException($"datacenter Id can't be greater than {idGenerator.MaxDatacenterId} or less than 0");
idGenerator.WorkerId = workerId;
idGenerator.DatacenterId = datacenterId;
WorkerId = workerId; return idGenerator;
DatacenterId = datacenterId;
} }
public long WorkerId { get; protected set; } public long WorkerId { get; internal set; }
public long DatacenterId { get; protected set; } public long DatacenterId { get; internal set; }
public long Sequence { get; protected set; } public long Sequence { get; internal set; }
public virtual long Create() public virtual long Create()
{ {

29
aspnet-core/modules/common/LINGYUN.Abp.IdGenerator/LINGYUN/Abp/IdGenerator/Snowflake/SnowflakeIdOptions.cs

@ -0,0 +1,29 @@
namespace LINGYUN.Abp.IdGenerator.Snowflake;
public class SnowflakeIdOptions
{
/// <summary>
/// 机器Id长度
/// </summary>
public int WorkerIdBits { get; set; }
/// <summary>
/// 机房Id长度
/// </summary>
public int DatacenterIdBits { get; set; }
/// <summary>
/// 12bit 的序号
/// </summary>
public long Sequence { get; set; }
/// <summary>
/// 每秒生成Id的数量
/// </summary>
public int SequenceBits { get; set; }
public SnowflakeIdOptions()
{
WorkerIdBits = 5;
DatacenterIdBits = 5;
Sequence = 0L;
SequenceBits = 12;
}
}

3
aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN.Abp.Notifications.csproj

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\configureawait.props" /> <Import Project="..\..\..\configureawait.props" />
<Import Project="..\..\..\common.props" /> <Import Project="..\..\..\common.props" />
@ -16,6 +16,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\LINGYUN.Abp.IdGenerator\LINGYUN.Abp.IdGenerator.csproj" />
<ProjectReference Include="..\LINGYUN.Abp.RealTime\LINGYUN.Abp.RealTime.csproj" /> <ProjectReference Include="..\LINGYUN.Abp.RealTime\LINGYUN.Abp.RealTime.csproj" />
</ItemGroup> </ItemGroup>

4
aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/AbpNotificationModule.cs

@ -1,4 +1,5 @@
using LINGYUN.Abp.Notifications.Internal; using LINGYUN.Abp.IdGenerator;
using LINGYUN.Abp.Notifications.Internal;
using LINGYUN.Abp.RealTime; using LINGYUN.Abp.RealTime;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
@ -16,6 +17,7 @@ namespace LINGYUN.Abp.Notifications
[DependsOn( [DependsOn(
typeof(AbpBackgroundWorkersModule), typeof(AbpBackgroundWorkersModule),
typeof(AbpBackgroundJobsAbstractionsModule), typeof(AbpBackgroundJobsAbstractionsModule),
typeof(AbpIdGeneratorModule),
typeof(AbpJsonModule), typeof(AbpJsonModule),
typeof(AbpRealTimeModule))] typeof(AbpRealTimeModule))]
public class AbpNotificationModule : AbpModule public class AbpNotificationModule : AbpModule

13
aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/Internal/NotificationSender.cs

@ -1,4 +1,5 @@
using LINGYUN.Abp.RealTime; using LINGYUN.Abp.IdGenerator;
using LINGYUN.Abp.RealTime;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
@ -26,19 +27,19 @@ namespace LINGYUN.Abp.Notifications
/// </summary> /// </summary>
public IDistributedEventBus DistributedEventBus { get; } public IDistributedEventBus DistributedEventBus { get; }
/// <summary> /// <summary>
/// Reference to <see cref="IMessageIdGenerator"/>. /// Reference to <see cref="IDistributedIdGenerator"/>.
/// </summary> /// </summary>
protected ISnowflakeIdrGenerator SnowflakeIdGenerator { get; } protected IDistributedIdGenerator DistributedIdGenerator { get; }
protected AbpNotificationOptions Options { get; } protected AbpNotificationOptions Options { get; }
public NotificationSender( public NotificationSender(
IDistributedEventBus distributedEventBus, IDistributedEventBus distributedEventBus,
ISnowflakeIdrGenerator snowflakeIdrGenerator, IDistributedIdGenerator distributedIdGenerator,
IOptions<AbpNotificationOptions> options) IOptions<AbpNotificationOptions> options)
{ {
Options = options.Value; Options = options.Value;
DistributedEventBus = distributedEventBus; DistributedEventBus = distributedEventBus;
SnowflakeIdGenerator = snowflakeIdrGenerator; DistributedIdGenerator = distributedIdGenerator;
Logger = NullLogger<NotificationSender>.Instance; Logger = NullLogger<NotificationSender>.Instance;
} }
@ -79,7 +80,7 @@ namespace LINGYUN.Abp.Notifications
{ {
var eto = new NotificationEto<NotificationData>(data) var eto = new NotificationEto<NotificationData>(data)
{ {
Id = SnowflakeIdGenerator.Create(), Id = DistributedIdGenerator.Create(),
TenantId = tenantId, TenantId = tenantId,
Users = users?.ToList(), Users = users?.ToList(),
Name = name, Name = name,

11
aspnet-core/modules/common/LINGYUN.Abp.RealTime/LINGYUN/Abp/RealTime/AbpRealTimeModule.cs

@ -1,6 +1,4 @@
using Microsoft.Extensions.DependencyInjection; using Volo.Abp.EventBus.Abstractions;
using Volo.Abp;
using Volo.Abp.EventBus.Abstractions;
using Volo.Abp.Modularity; using Volo.Abp.Modularity;
namespace LINGYUN.Abp.RealTime namespace LINGYUN.Abp.RealTime
@ -8,12 +6,5 @@ namespace LINGYUN.Abp.RealTime
[DependsOn(typeof(AbpEventBusAbstractionsModule))] [DependsOn(typeof(AbpEventBusAbstractionsModule))]
public class AbpRealTimeModule : AbpModule public class AbpRealTimeModule : AbpModule
{ {
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
context
.ServiceProvider
.GetRequiredService<SnowflakeIdrGenerator>()
.Initialize();
}
} }
} }

7
aspnet-core/modules/common/LINGYUN.Abp.RealTime/LINGYUN/Abp/RealTime/ISnowflakeIdrGenerator.cs

@ -1,7 +0,0 @@
namespace LINGYUN.Abp.RealTime
{
public interface ISnowflakeIdrGenerator
{
long Create();
}
}

24
aspnet-core/modules/common/LINGYUN.Abp.RealTime/LINGYUN/Abp/RealTime/SnowflakeIdOptions.cs

@ -1,24 +0,0 @@
namespace LINGYUN.Abp.RealTime
{
public class SnowflakeIdOptions
{
/// <summary>
/// 机器Id长度
/// </summary>
public int WorkerIdBits { get; set; }
/// <summary>
/// 机房Id长度
/// </summary>
public int DatacenterIdBits { get; set; }
/// <summary>
/// 每秒生成Id的数量
/// </summary>
public int SequenceBits { get; set; }
public SnowflakeIdOptions()
{
WorkerIdBits = 5;
DatacenterIdBits = 5;
SequenceBits = 12;
}
}
}

1
aspnet-core/modules/logging/LINGYUN.Abp.Logging.Serilog.Elasticsearch/LINGYUN.Abp.Logging.Serilog.Elasticsearch.csproj

@ -18,6 +18,7 @@
<ProjectReference Include="..\..\elasticsearch\LINGYUN.Abp.Elasticsearch\LINGYUN.Abp.Elasticsearch.csproj" /> <ProjectReference Include="..\..\elasticsearch\LINGYUN.Abp.Elasticsearch\LINGYUN.Abp.Elasticsearch.csproj" />
<ProjectReference Include="..\LINGYUN.Abp.Logging\LINGYUN.Abp.Logging.csproj" /> <ProjectReference Include="..\LINGYUN.Abp.Logging\LINGYUN.Abp.Logging.csproj" />
<ProjectReference Include="..\LINGYUN.Abp.Serilog.Enrichers.Application\LINGYUN.Abp.Serilog.Enrichers.Application.csproj" /> <ProjectReference Include="..\LINGYUN.Abp.Serilog.Enrichers.Application\LINGYUN.Abp.Serilog.Enrichers.Application.csproj" />
<ProjectReference Include="..\LINGYUN.Abp.Serilog.Enrichers.UniqueId\LINGYUN.Abp.Serilog.Enrichers.UniqueId.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

3
aspnet-core/modules/logging/LINGYUN.Abp.Logging.Serilog.Elasticsearch/LINGYUN/Abp/AuditLogging/Serilog/Elasticsearch/AbpLoggingSerilogElasticsearchMapperProfile.cs

@ -7,7 +7,8 @@ namespace LINGYUN.Abp.Logging.Serilog.Elasticsearch
public AbpLoggingSerilogElasticsearchMapperProfile() public AbpLoggingSerilogElasticsearchMapperProfile()
{ {
CreateMap<SerilogException, LogException>(); CreateMap<SerilogException, LogException>();
CreateMap<SerilogField, LogField>(); CreateMap<SerilogField, LogField>()
.ForMember(log => log.Id, map => map.MapFrom(slog => slog.UniqueId.ToString()));
CreateMap<SerilogInfo, LogInfo>(); CreateMap<SerilogInfo, LogInfo>();
} }
} }

52
aspnet-core/modules/logging/LINGYUN.Abp.Logging.Serilog.Elasticsearch/LINGYUN/Abp/AuditLogging/Serilog/Elasticsearch/SerilogElasticsearchLoggingManager.cs

@ -1,5 +1,6 @@
using LINGYUN.Abp.Elasticsearch; using LINGYUN.Abp.Elasticsearch;
using LINGYUN.Abp.Serilog.Enrichers.Application; using LINGYUN.Abp.Serilog.Enrichers.Application;
using LINGYUN.Abp.Serilog.Enrichers.UniqueId;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
@ -71,8 +72,8 @@ namespace LINGYUN.Abp.Logging.Serilog.Elasticsearch
}, },
{ {
"term": { "term": {
"@timestamp": { "fields.UniqueId": {
"value": "2021-10-31T09:53:12.3406273+08:00" "value": "1474021081433481216"
} }
} }
} }
@ -87,9 +88,9 @@ namespace LINGYUN.Abp.Logging.Serilog.Elasticsearch
(q) => q.Bool( (q) => q.Bool(
(b) => b.Must( (b) => b.Must(
(s) => s.Term( (s) => s.Term(
(t) => t.Field("@timestamp").Value(id)), (t) => t.Field(GetField(nameof(SerilogInfo.Fields.UniqueId))).Value(id)),
(s) => s.Term( (s) => s.Term(
(t) => t.Field(f => f.Fields.TenantId.Suffix("keyword")).Value(_currentTenant.GetId()))))), (t) => t.Field(GetField(nameof(SerilogInfo.Fields.TenantId))).Value(_currentTenant.GetId()))))),
cancellationToken); cancellationToken);
} }
else else
@ -100,8 +101,8 @@ namespace LINGYUN.Abp.Logging.Serilog.Elasticsearch
"must": [ "must": [
{ {
"term": { "term": {
"@timestamp": { "fields.UniqueId": {
"value": "2021-10-31T09:53:12.3406273+08:00" "value": "1474021081433481216"
} }
} }
} }
@ -116,7 +117,7 @@ namespace LINGYUN.Abp.Logging.Serilog.Elasticsearch
(q) => q.Bool( (q) => q.Bool(
(b) => b.Must( (b) => b.Must(
(s) => s.Term( (s) => s.Term(
(t) => t.Field("@timestamp").Value(id))))), (t) => t.Field(GetField(nameof(SerilogInfo.Fields.UniqueId))).Value(id))))),
cancellationToken); cancellationToken);
} }
@ -210,7 +211,9 @@ namespace LINGYUN.Abp.Logging.Serilog.Elasticsearch
var sortOrder = !sorting.IsNullOrWhiteSpace() && sorting.EndsWith("asc", StringComparison.InvariantCultureIgnoreCase) var sortOrder = !sorting.IsNullOrWhiteSpace() && sorting.EndsWith("asc", StringComparison.InvariantCultureIgnoreCase)
? SortOrder.Ascending : SortOrder.Descending; ? SortOrder.Ascending : SortOrder.Descending;
sorting = sorting ?? "timestamp"; sorting = !sorting.IsNullOrWhiteSpace()
? sorting.Split()[0]
: nameof(SerilogInfo.TimeStamp);
var querys = BuildQueryDescriptor( var querys = BuildQueryDescriptor(
startTime, startTime,
@ -241,7 +244,9 @@ namespace LINGYUN.Abp.Logging.Serilog.Elasticsearch
var response = await client.SearchAsync<SerilogInfo>((dsl) => var response = await client.SearchAsync<SerilogInfo>((dsl) =>
dsl.Index(CreateIndex()) dsl.Index(CreateIndex())
.Query(log => log.Bool(b => b.Must(querys.ToArray()))) .Query(log =>
log.Bool(b =>
b.Must(querys.ToArray())))
.Source(SourceFilter) .Source(SourceFilter)
.Sort(log => log.Field(GetField(sorting), sortOrder)) .Sort(log => log.Field(GetField(sorting), sortOrder))
.From(skipCount) .From(skipCount)
@ -270,55 +275,56 @@ namespace LINGYUN.Abp.Logging.Serilog.Elasticsearch
if (_currentTenant.IsAvailable) if (_currentTenant.IsAvailable)
{ {
querys.Add((log) => log.Term((q) => q.Field((f) => f.Fields.TenantId.Suffix("keyword")).Value(_currentTenant.GetId()))); querys.Add((log) => log.Term((q) => q.Field(GetField(nameof(SerilogInfo.Fields.TenantId))).Value(_currentTenant.GetId())));
} }
if (startTime.HasValue) if (startTime.HasValue)
{ {
querys.Add((log) => log.DateRange((q) => q.Field(f => f.TimeStamp).GreaterThanOrEquals(startTime))); querys.Add((log) => log.DateRange((q) => q.Field(GetField(nameof(SerilogInfo.TimeStamp))).GreaterThanOrEquals(startTime)));
} }
if (endTime.HasValue) if (endTime.HasValue)
{ {
querys.Add((log) => log.DateRange((q) => q.Field(f => f.TimeStamp).LessThanOrEquals(endTime))); querys.Add((log) => log.DateRange((q) => q.Field(GetField(nameof(SerilogInfo.TimeStamp))).LessThanOrEquals(endTime)));
} }
if (level.HasValue) if (level.HasValue)
{ {
querys.Add((log) => log.Term((q) => q.Field(f => f.Level.Suffix("keyword")).Value(level.ToString()))); querys.Add((log) => log.Term((q) => q.Field(GetField(nameof(SerilogInfo.Level))).Value(level.ToString())));
} }
if (!machineName.IsNullOrWhiteSpace()) if (!machineName.IsNullOrWhiteSpace())
{ {
querys.Add((log) => log.Term((q) => q.Field((f) => f.Fields.MachineName.Suffix("keyword")).Value(machineName))); querys.Add((log) => log.Term((q) => q.Field(GetField(nameof(SerilogInfo.Fields.MachineName))).Value(machineName)));
} }
if (!environment.IsNullOrWhiteSpace()) if (!environment.IsNullOrWhiteSpace())
{ {
querys.Add((log) => log.Term((q) => q.Field((f) => f.Fields.Environment.Suffix("keyword")).Value(environment))); querys.Add((log) => log.Term((q) => q.Field(GetField(nameof(SerilogInfo.Fields.Environment))).Value(environment)));
} }
if (!application.IsNullOrWhiteSpace()) if (!application.IsNullOrWhiteSpace())
{ {
querys.Add((log) => log.Term((q) => q.Field((f) => f.Fields.Application.Suffix("keyword")).Value(application))); querys.Add((log) => log.Term((q) => q.Field(GetField(nameof(SerilogInfo.Fields.Application))).Value(application)));
} }
if (!context.IsNullOrWhiteSpace()) if (!context.IsNullOrWhiteSpace())
{ {
querys.Add((log) => log.Term((q) => q.Field((f) => f.Fields.Context.Suffix("keyword")).Value(context))); querys.Add((log) => log.Term((q) => q.Field(GetField(nameof(SerilogInfo.Fields.Context))).Value(context)));
} }
if (!requestId.IsNullOrWhiteSpace()) if (!requestId.IsNullOrWhiteSpace())
{ {
querys.Add((log) => log.Match((q) => q.Field(f => f.Fields.RequestId.Suffix("keyword")).Query(requestId))); querys.Add((log) => log.Term((q) => q.Field(GetField(nameof(SerilogInfo.Fields.RequestId))).Value(requestId)));
} }
if (!requestPath.IsNullOrWhiteSpace()) if (!requestPath.IsNullOrWhiteSpace())
{ {
querys.Add((log) => log.Term((q) => q.Field(f => f.Fields.RequestPath.Suffix("keyword")).Value(requestPath))); // 模糊匹配
querys.Add((log) => log.MatchPhrasePrefix((q) => q.Field(f => f.Fields.RequestPath).Query(requestPath)));
} }
if (!correlationId.IsNullOrWhiteSpace()) if (!correlationId.IsNullOrWhiteSpace())
{ {
querys.Add((log) => log.Term((q) => q.Field(f => f.Fields.CorrelationId.Suffix("keyword")).Value(correlationId))); querys.Add((log) => log.MatchPhrase((q) => q.Field(GetField(nameof(SerilogInfo.Fields.CorrelationId))).Query(correlationId)));
} }
if (processId.HasValue) if (processId.HasValue)
{ {
querys.Add((log) => log.Term((q) => q.Field(f => f.Fields.ProcessId).Value(processId))); querys.Add((log) => log.Term((q) => q.Field(GetField(nameof(SerilogInfo.Fields.ProcessId))).Value(processId)));
} }
if (threadId.HasValue) if (threadId.HasValue)
{ {
querys.Add((log) => log.Term((q) => q.Field(f => f.Fields.ThreadId).Value(threadId))); querys.Add((log) => log.Term((q) => q.Field(GetField(nameof(SerilogInfo.Fields.ThreadId))).Value(threadId)));
} }
if (hasException.HasValue) if (hasException.HasValue)
@ -386,6 +392,8 @@ namespace LINGYUN.Abp.Logging.Serilog.Elasticsearch
{ "userid", "fields.UserId.keyword" }, { "userid", "fields.UserId.keyword" },
{ "processid", "fields.ProcessId" }, { "processid", "fields.ProcessId" },
{ "threadid", "fields.ThreadId" }, { "threadid", "fields.ThreadId" },
{ "id", $"fields.{AbpSerilogUniqueIdConsts.UniqueIdPropertyName}" },
{ "uniqueid", $"fields.{AbpSerilogUniqueIdConsts.UniqueIdPropertyName}" },
}; };
protected virtual string GetField(string field) protected virtual string GetField(string field)
{ {

4
aspnet-core/modules/logging/LINGYUN.Abp.Logging.Serilog.Elasticsearch/LINGYUN/Abp/AuditLogging/Serilog/Elasticsearch/SerilogField.cs

@ -1,10 +1,14 @@
using LINGYUN.Abp.Serilog.Enrichers.Application; using LINGYUN.Abp.Serilog.Enrichers.Application;
using LINGYUN.Abp.Serilog.Enrichers.UniqueId;
using System; using System;
namespace LINGYUN.Abp.Logging.Serilog.Elasticsearch namespace LINGYUN.Abp.Logging.Serilog.Elasticsearch
{ {
public class SerilogField public class SerilogField
{ {
[Nest.PropertyName(AbpSerilogUniqueIdConsts.UniqueIdPropertyName)]
public long UniqueId { get; set; }
[Nest.PropertyName(AbpLoggingEnricherPropertyNames.MachineName)] [Nest.PropertyName(AbpLoggingEnricherPropertyNames.MachineName)]
public string MachineName { get; set; } public string MachineName { get; set; }

1
aspnet-core/modules/logging/LINGYUN.Abp.Logging/LINGYUN/Abp/AuditLogging/LogField.cs

@ -2,6 +2,7 @@
{ {
public class LogField public class LogField
{ {
public string Id { get; set; }
public string MachineName { get; set; } public string MachineName { get; set; }
public string Environment { get; set; } public string Environment { get; set; }
public string Application { get; set; } public string Application { get; set; }

3
aspnet-core/modules/logging/LINGYUN.Abp.Serilog.Enrichers.UniqueId/FodyWeavers.xml

@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ConfigureAwait />
</Weavers>

30
aspnet-core/modules/logging/LINGYUN.Abp.Serilog.Enrichers.UniqueId/FodyWeavers.xsd

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" />
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>

19
aspnet-core/modules/logging/LINGYUN.Abp.Serilog.Enrichers.UniqueId/LINGYUN.Abp.Serilog.Enrichers.UniqueId.csproj

@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\configureawait.props" />
<Import Project="..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace />
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Serilog" Version="$(SerilogPackageVersion)" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\common\LINGYUN.Abp.IdGenerator\LINGYUN.Abp.IdGenerator.csproj" />
</ItemGroup>
</Project>

10
aspnet-core/modules/logging/LINGYUN.Abp.Serilog.Enrichers.UniqueId/LINGYUN/Abp/Serilog/Enrichers/UniqueId/AbpSerilogEnrichersUniqueIdModule.cs

@ -0,0 +1,10 @@
using LINGYUN.Abp.IdGenerator;
using Volo.Abp.Modularity;
namespace LINGYUN.Abp.Serilog.Enrichers.UniqueId
{
[DependsOn(typeof(AbpIdGeneratorModule))]
public class AbpSerilogEnrichersUniqueIdModule : AbpModule
{
}
}

7
aspnet-core/modules/logging/LINGYUN.Abp.Serilog.Enrichers.UniqueId/LINGYUN/Abp/Serilog/Enrichers/UniqueId/AbpSerilogUniqueIdConsts.cs

@ -0,0 +1,7 @@
namespace LINGYUN.Abp.Serilog.Enrichers.UniqueId
{
public class AbpSerilogUniqueIdConsts
{
public const string UniqueIdPropertyName = "UniqueId";
}
}

21
aspnet-core/modules/logging/LINGYUN.Abp.Serilog.Enrichers.UniqueId/LINGYUN/Abp/Serilog/Enrichers/UniqueId/UniqueIdEnricher.cs

@ -0,0 +1,21 @@
using LINGYUN.Abp.IdGenerator;
using LINGYUN.Abp.IdGenerator.Snowflake;
using Serilog.Core;
using Serilog.Events;
namespace LINGYUN.Abp.Serilog.Enrichers.UniqueId
{
public class UniqueIdEnricher : ILogEventEnricher
{
private readonly static IDistributedIdGenerator _distributedIdGenerator
= SnowflakeIdGenerator.Create(new SnowflakeIdOptions());
public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
{
logEvent.AddOrUpdateProperty(
propertyFactory.CreateProperty(
AbpSerilogUniqueIdConsts.UniqueIdPropertyName,
_distributedIdGenerator.Create()));
}
}
}

16
aspnet-core/modules/logging/LINGYUN.Abp.Serilog.Enrichers.UniqueId/Serilog/UniqueIdLoggerConfigurationExtensions.cs

@ -0,0 +1,16 @@
using LINGYUN.Abp.Serilog.Enrichers.UniqueId;
using Serilog.Configuration;
using System;
namespace Serilog
{
public static class UniqueIdLoggerConfigurationExtensions
{
public static LoggerConfiguration WithUniqueId(
this LoggerEnrichmentConfiguration enrichmentConfiguration)
{
if (enrichmentConfiguration == null) throw new ArgumentNullException(nameof(enrichmentConfiguration));
return enrichmentConfiguration.With<UniqueIdEnricher>();
}
}
}

79
aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/BackendAdminHttpApiHostModule.cs

@ -11,6 +11,7 @@ using LINGYUN.Abp.Logging.Serilog.Elasticsearch;
using LINGYUN.Abp.MultiTenancy.DbFinder; using LINGYUN.Abp.MultiTenancy.DbFinder;
using LINGYUN.Abp.PermissionManagement.Identity; using LINGYUN.Abp.PermissionManagement.Identity;
using LINGYUN.Abp.Serilog.Enrichers.Application; using LINGYUN.Abp.Serilog.Enrichers.Application;
using LINGYUN.Abp.Serilog.Enrichers.UniqueId;
using LINGYUN.Abp.SettingManagement; using LINGYUN.Abp.SettingManagement;
using LINGYUN.Abp.Sms.Aliyun; using LINGYUN.Abp.Sms.Aliyun;
using LINGYUN.Abp.TenantManagement; using LINGYUN.Abp.TenantManagement;
@ -40,43 +41,44 @@ using Volo.Abp.TenantManagement.EntityFrameworkCore;
namespace LY.MicroService.BackendAdmin; namespace LY.MicroService.BackendAdmin;
[DependsOn( [DependsOn(
typeof(AbpSerilogEnrichersApplicationModule), typeof(AbpSerilogEnrichersApplicationModule),
typeof(AbpAspNetCoreSerilogModule), typeof(AbpSerilogEnrichersUniqueIdModule),
typeof(AbpLoggingSerilogElasticsearchModule), typeof(AbpAspNetCoreSerilogModule),
typeof(AbpAuditLoggingElasticsearchModule), typeof(AbpLoggingSerilogElasticsearchModule),
typeof(AbpAspNetCoreMvcUiMultiTenancyModule), typeof(AbpAuditLoggingElasticsearchModule),
typeof(AbpSettingManagementApplicationModule), typeof(AbpAspNetCoreMvcUiMultiTenancyModule),
typeof(AbpSettingManagementHttpApiModule), typeof(AbpSettingManagementApplicationModule),
typeof(AbpPermissionManagementApplicationModule), typeof(AbpSettingManagementHttpApiModule),
typeof(AbpPermissionManagementHttpApiModule), typeof(AbpPermissionManagementApplicationModule),
typeof(AbpFeatureManagementApplicationModule), typeof(AbpPermissionManagementHttpApiModule),
typeof(AbpFeatureManagementHttpApiModule), typeof(AbpFeatureManagementApplicationModule),
typeof(AbpFeatureManagementClientModule), typeof(AbpFeatureManagementHttpApiModule),
typeof(AbpAuditingApplicationModule), typeof(AbpFeatureManagementClientModule),
typeof(AbpAuditingHttpApiModule), typeof(AbpAuditingApplicationModule),
typeof(AbpTenantManagementApplicationModule), typeof(AbpAuditingHttpApiModule),
typeof(AbpTenantManagementHttpApiModule), typeof(AbpTenantManagementApplicationModule),
typeof(AbpEntityFrameworkCoreMySQLModule), typeof(AbpTenantManagementHttpApiModule),
typeof(AbpIdentityEntityFrameworkCoreModule),// 用户角色权限需要引用包 typeof(AbpEntityFrameworkCoreMySQLModule),
typeof(AbpIdentityServerEntityFrameworkCoreModule), // 客户端权限需要引用包 typeof(AbpIdentityEntityFrameworkCoreModule),// 用户角色权限需要引用包
typeof(AbpTenantManagementEntityFrameworkCoreModule), typeof(AbpIdentityServerEntityFrameworkCoreModule), // 客户端权限需要引用包
typeof(AbpSettingManagementEntityFrameworkCoreModule), typeof(AbpTenantManagementEntityFrameworkCoreModule),
typeof(AbpPermissionManagementDomainIdentityModule), typeof(AbpSettingManagementEntityFrameworkCoreModule),
typeof(AbpPermissionManagementDomainIdentityServerModule), typeof(AbpPermissionManagementDomainIdentityModule),
typeof(AbpPermissionManagementEntityFrameworkCoreModule), typeof(AbpPermissionManagementDomainIdentityServerModule),
typeof(AbpFeatureManagementEntityFrameworkCoreModule), typeof(AbpPermissionManagementEntityFrameworkCoreModule),
typeof(AbpLocalizationManagementEntityFrameworkCoreModule), typeof(AbpFeatureManagementEntityFrameworkCoreModule),
typeof(AbpDataDbMigratorModule), typeof(AbpLocalizationManagementEntityFrameworkCoreModule),
typeof(AbpAspNetCoreAuthenticationJwtBearerModule), typeof(AbpDataDbMigratorModule),
typeof(AbpEmailingExceptionHandlingModule), typeof(AbpAspNetCoreAuthenticationJwtBearerModule),
typeof(AbpCAPEventBusModule), typeof(AbpEmailingExceptionHandlingModule),
typeof(AbpAliyunSmsModule), typeof(AbpCAPEventBusModule),
typeof(AbpDbFinderMultiTenancyModule), typeof(AbpAliyunSmsModule),
typeof(AbpCachingStackExchangeRedisModule), typeof(AbpDbFinderMultiTenancyModule),
typeof(AbpAspNetCoreHttpOverridesModule), typeof(AbpCachingStackExchangeRedisModule),
typeof(AbpLocalizationCultureMapModule), typeof(AbpAspNetCoreHttpOverridesModule),
typeof(AbpAutofacModule) typeof(AbpLocalizationCultureMapModule),
)] typeof(AbpAutofacModule)
)]
public partial class BackendAdminHttpApiHostModule : AbpModule public partial class BackendAdminHttpApiHostModule : AbpModule
{ {
public override void PreConfigureServices(ServiceConfigurationContext context) public override void PreConfigureServices(ServiceConfigurationContext context)
@ -89,8 +91,9 @@ public partial class BackendAdminHttpApiHostModule : AbpModule
public override void ConfigureServices(ServiceConfigurationContext context) public override void ConfigureServices(ServiceConfigurationContext context)
{ {
context.Services.AddAlwaysAllowAuthorization();
var hostingEnvironment = context.Services.GetHostingEnvironment(); var hostingEnvironment = context.Services.GetHostingEnvironment();
var configuration = hostingEnvironment.BuildConfiguration(); var configuration = context.Services.GetConfiguration();
ConfigureDbContext(); ConfigureDbContext();
ConfigureJsonSerializer(); ConfigureJsonSerializer();

1
aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/LY.MicroService.BackendAdmin.HttpApi.Host.csproj

@ -62,6 +62,7 @@
<ProjectReference Include="..\..\modules\localization\LINGYUN.Abp.Localization.CultureMap\LINGYUN.Abp.Localization.CultureMap.csproj" /> <ProjectReference Include="..\..\modules\localization\LINGYUN.Abp.Localization.CultureMap\LINGYUN.Abp.Localization.CultureMap.csproj" />
<ProjectReference Include="..\..\modules\logging\LINGYUN.Abp.Logging.Serilog.Elasticsearch\LINGYUN.Abp.Logging.Serilog.Elasticsearch.csproj" /> <ProjectReference Include="..\..\modules\logging\LINGYUN.Abp.Logging.Serilog.Elasticsearch\LINGYUN.Abp.Logging.Serilog.Elasticsearch.csproj" />
<ProjectReference Include="..\..\modules\logging\LINGYUN.Abp.Serilog.Enrichers.Application\LINGYUN.Abp.Serilog.Enrichers.Application.csproj" /> <ProjectReference Include="..\..\modules\logging\LINGYUN.Abp.Serilog.Enrichers.Application\LINGYUN.Abp.Serilog.Enrichers.Application.csproj" />
<ProjectReference Include="..\..\modules\logging\LINGYUN.Abp.Serilog.Enrichers.UniqueId\LINGYUN.Abp.Serilog.Enrichers.UniqueId.csproj" />
<ProjectReference Include="..\..\modules\lt\LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore\LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore.csproj" /> <ProjectReference Include="..\..\modules\lt\LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore\LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\modules\identity\LINGYUN.Abp.PermissionManagement.Domain.Identity\LINGYUN.Abp.PermissionManagement.Domain.Identity.csproj" /> <ProjectReference Include="..\..\modules\identity\LINGYUN.Abp.PermissionManagement.Domain.Identity\LINGYUN.Abp.PermissionManagement.Domain.Identity.csproj" />
<ProjectReference Include="..\..\modules\common\LINGYUN.Abp.Sms.Aliyun\LINGYUN.Abp.Sms.Aliyun.csproj" /> <ProjectReference Include="..\..\modules\common\LINGYUN.Abp.Sms.Aliyun\LINGYUN.Abp.Sms.Aliyun.csproj" />

2
aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/Properties/launchSettings.json

@ -14,7 +14,7 @@
"launchBrowser": false, "launchBrowser": false,
"applicationUrl": "http://127.0.0.1:30010", "applicationUrl": "http://127.0.0.1:30010",
"environmentVariables": { "environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development" "ASPNETCORE_ENVIRONMENT": "Production"
} }
} }
} }

2
aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/appsettings.json

@ -13,7 +13,7 @@
"DotNetCore": "Information" "DotNetCore": "Information"
} }
}, },
"Enrich": [ "FromLogContext", "WithProcessId", "WithThreadId", "WithEnvironmentName", "WithMachineName", "WithApplicationName" ], "Enrich": [ "FromLogContext", "WithProcessId", "WithThreadId", "WithEnvironmentName", "WithMachineName", "WithApplicationName", "WithUniqueId" ],
"WriteTo": [ "WriteTo": [
{ {
"Name": "Console", "Name": "Console",

Loading…
Cancel
Save