Closed BoomUserWarning closed 4 years ago
Does itbhavebto be a tag? As far as I know, tags are defined on the static LogglyConfig object and will be added to every message sent with the same configuration, as you mentioned.
The easiest way to get log event specific values would be to either add those values to the event object being logged or to use the LogContext to push properties into the property stack if you want to add them to a series of messages (https://github.com/serilog/serilog/wiki/Enrichment)
Em 02/02/2018 19:28, "BoomUserWarning" notifications@github.com escreveu:
It looks like when you configure Loggly, you can add tags that you want added to your messages that are getting logged:
//Configure Loggly var config = LogglyConfig.Instance; config.CustomerToken = customerToken; config.ApplicationName = appName; config.Transport = new TransportConfiguration() { EndpointHostname = "logs-01.loggly.com", EndpointPort = 443, LogTransport = LogTransport.Https }; config.ThrowExceptions = true;
//Define Tags sent to Loggly config.TagConfig.Tags.AddRange(new ITag[]{ new ApplicationNameTag {Formatter = "application-{0}"}, new HostnameTag { Formatter = "host-{0}" }, new SimpleTag { Value = "Test Tag" } // my custom test tag });
So now whenever I call Log.Information("..."), those tags are added to what I'm logging. But it's at a global level, it doesn't seem to be able to be changed at all, "Test Tag" is just applied to everything.
For my application, I'm receiving messages from a service bus, which can send through several different types of events. Based on the type of event, a different function is called. I'm logging information in each of these functions.
But I'd like to tag each of these with an event code, so that I can easily go into Loggly and see what was logged based on the type of events that were passed through the service bus to my application.
Is there any way to add a tag with a dynamic value at the point when I'm actually logging something?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/serilog/serilog-sinks-loggly/issues/36, or mute the thread https://github.com/notifications/unsubscribe-auth/AF-5TzaDeUOWFEqi6Ffy1BOjgfC3VF76ks5tQ2HEgaJpZM4R3qZ6 .
closing due to inactivity
It looks like when you configure Loggly, you can add tags that you want added to your messages that are getting logged:
So now whenever I call Log.Information("..."), those tags are added to what I'm logging. But it's at a global level, it doesn't seem to be able to be changed at all, "Test Tag" is just applied to everything.
For my application, I'm receiving messages from a service bus, which can send through several different types of events. Based on the type of event, a different function is called. I'm logging information in each of these functions.
But I'd like to tag each of these with an event code, so that I can easily go into Loggly and see what was logged based on the type of events that were passed through the service bus to my application.
Is there any way to add a tag with a dynamic value at the point when I'm actually logging something?