diff --git a/src/SerilogEcsLogging/Logging/EcsDocument.cs b/src/SerilogEcsLogging/Logging/EcsDocument.cs index f5d9de8..b25f375 100644 --- a/src/SerilogEcsLogging/Logging/EcsDocument.cs +++ b/src/SerilogEcsLogging/Logging/EcsDocument.cs @@ -1,4 +1,5 @@ -using Elastic.CommonSchema; +using System.Reflection; +using Elastic.CommonSchema; namespace SerilogEcsLogging.Logging; @@ -32,10 +33,15 @@ public EcsDocument(IEcsEvent ev) }; } - if (ev.ServiceState != null) - { - Service = new Service { State = ev.ServiceState.ToString() }; - } + Service = new Service { + State = ev.ServiceState?.ToString(), + Name = Assembly.GetExecutingAssembly().GetName().Name, + Version = Assembly.GetExecutingAssembly().GetName().Version?.ToString(), + Type = ev.EventModule, + Address = System.Net.Dns.GetHostName() + }; + + Host = new Host { Hostname = Service.Address }; TransactionId = ev.TransactionId; TraceId = ev.TraceId; diff --git a/src/SerilogEcsLogging/SerilogEcsLogging.csproj b/src/SerilogEcsLogging/SerilogEcsLogging.csproj index 9a9897f..5ebd078 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.3 + 1.1.4