Skip to content

Commit

Permalink
Added AssemblyName to Tags
Browse files Browse the repository at this point in the history
  • Loading branch information
mrapavy committed Feb 1, 2024
1 parent 870c3d8 commit fe3c4a7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/SerilogEcsLogging/Logging/EcsMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion src/SerilogEcsLogging/SerilogEcsLogging.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>mrapavy</Authors>
<PackageProjectUrl>https://github.com/mrapavy/serilog-ecs-logging</PackageProjectUrl>
<Version>1.1.5</Version>
<Version>1.1.6</Version>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit fe3c4a7

Please sign in to comment.