I have seen two other forum discussions regarding the Service Name, but none of those people were using the Logging Infrastructure Agent. My team is using the infrastructure agent for logging, so we are sending our logs via TCP.
Our logging solution looks like this:
Log.Logger = new LoggerConfiguration() .MinimumLevel.Debug() .MinimumLevel.Override("Microsoft", LogEventLevel.Warning) .Enrich.FromLogContext() .Enrich.WithProperty("ServiceName", service) .WriteTo.File(new NewRelicFormatter(), filePath, LogEventLevel.Debug, rollingInterval: RollingInterval.Day) .WriteTo.TCPSink( IPAddress.Parse(tcpAddress), tcpPort, new NewRelicFormatter(), LogEventLevel.Debug) .CreateLogger();
We tried to add the ServiceName as a property, but that doesn’t seem to help. It allows ut to search on a ServiceName attribute, but still no Service Name when diving into an individual log.
Any idea how to give a log record a “Service Name”?