serilog / serilog-enrichers-environment

Enrich Serilog log events with properties from System.Environment.
Apache License 2.0
80 stars 33 forks source link

Pivotal Cloud Foundry containers does not define HOSTNAME, use CF_INSTANCE_INDEX #25

Closed gustavo-armenta closed 6 years ago

nblumhardt commented 6 years ago

Hi - thanks for the PR. It's a bit environment-specific to make the change here; over time we'd end up with a soup of variables for different providers.

Perhaps a good option is just to add Enrich.With("MachineName", Enivronment.GetEnvironmentVariable("CF_INSTANCE_INDEX") to your logger configuration?

NB

gustavo-armenta commented 6 years ago

I still need to set the machinename to COMPUTERNAME when running on windows, HOSTNAME when running on Linux, CF_INSTANCE_INDEX when running on PCF, and who knows what comes from other environments

nblumhardt commented 6 years ago

Howdy, yes, but I don't think we want to take on that pain in this library :-)

gustavo-armenta commented 6 years ago

Sounds reasonable. I have implemented a custom enricher. Thank you for the review :)

nblumhardt commented 6 years ago

:+1: you're welcome