ECS integration/library project(s) (e.g. Elastic.CommonSchema.Serilog):
I'm using the Elastic.CommonSchema.Serilog.EcsTextFormatter, Elastic.CommonSchema.Serilog (8.6.1) to output my logs in the ECS standard.
ECS schema version (e.g. 1.4.0):
The ecs.version is 8.6.0
ECS .NET assembly version (e.g. 1.4.2):
Elastic.CommonSchema.Serilog.EcsTextFormatter, Elastic.CommonSchema.Serilog (8.6.1)
Elasticsearch version (if applicable):
n/a
.NET framework / OS:
.net 6.0
Description of the problem, including expected versus actual behavior:
Depending on the stage I run my application in different environements like Testing, Staging or Production. There are different ways doing this:
setup the environment variable with DOTNET_ENVIRONEMENT={STAGE}
start the application with the argument parameter --environment {STAGE}
Anyway in microsoft dotnet we have the concept of IHostBuilder who is responsible to setup the IHostingEnvironment. I would expect that in the log output the application name and the application environment will be used from IHostingEnvironment if no other variables like ELASTIC_APM_ENVIRONMENT, OTEL_RESOURCE_ATTRIBUTES or deployment.environment variables are existing.
Starting a console application could be look like on windows:
$ ./JustAApplication.Console.exe --environment Testing --applicationName JustAnother.Application
ECS integration/library project(s) (e.g. Elastic.CommonSchema.Serilog): I'm using the Elastic.CommonSchema.Serilog.EcsTextFormatter, Elastic.CommonSchema.Serilog (8.6.1) to output my logs in the ECS standard.
ECS schema version (e.g. 1.4.0): The ecs.version is 8.6.0
ECS .NET assembly version (e.g. 1.4.2): Elastic.CommonSchema.Serilog.EcsTextFormatter, Elastic.CommonSchema.Serilog (8.6.1)
Elasticsearch version (if applicable): n/a
.NET framework / OS: .net 6.0
Description of the problem, including expected versus actual behavior: Depending on the stage I run my application in different environements like Testing, Staging or Production. There are different ways doing this:
Anyway in microsoft dotnet we have the concept of IHostBuilder who is responsible to setup the IHostingEnvironment. I would expect that in the log output the application name and the application environment will be used from IHostingEnvironment if no other variables like ELASTIC_APM_ENVIRONMENT, OTEL_RESOURCE_ATTRIBUTES or deployment.environment variables are existing.
Starting a console application could be look like on windows:
$ ./JustAApplication.Console.exe --environment Testing --applicationName JustAnother.Application
Actual behaviour of the log output:
Expected behaviour of the log output:
Steps to reproduce: