diff --git a/src/SerilogEcsLogging/Logging/EcsMapper.cs b/src/SerilogEcsLogging/Logging/EcsMapper.cs index 0a4aad9..2a7476b 100644 --- a/src/SerilogEcsLogging/Logging/EcsMapper.cs +++ b/src/SerilogEcsLogging/Logging/EcsMapper.cs @@ -20,6 +20,13 @@ public static Elastic.CommonSchema.EcsDocument MapLogEvent(Elastic.CommonSchema. string[] tagsStrings = Array.ConvertAll(tags, o => o.ToString()).Where(t => t != null).ToArray()!; result.Tags = result.Tags != null ? result.Tags.Concat(tagsStrings).ToArray() : tagsStrings; } + + // Add AssemblyName to Tags + if (logEvent.Properties.TryGetValue("AssemblyName", out var assemblyName) && assemblyName is ScalarValue) + { + var serviceName = assemblyName.ToString().Trim('"'); + result.Tags = result.Tags != null ? result.Tags.Concat(new[] { serviceName }).ToArray() : new[] { serviceName }; + } if (result.Tags != null) { diff --git a/src/SerilogEcsLogging/SerilogEcsLogging.csproj b/src/SerilogEcsLogging/SerilogEcsLogging.csproj index 91c74d3..7278567 100644 --- a/src/SerilogEcsLogging/SerilogEcsLogging.csproj +++ b/src/SerilogEcsLogging/SerilogEcsLogging.csproj @@ -7,7 +7,7 @@ true mrapavy https://github.com/mrapavy/serilog-ecs-logging - 1.1.5 + 1.1.6