Questions tagged [structured-logging]

47 questions
2
votes
1 answer

Structured logging in an Azure Function v3 with Azure Log Analytics

I'm trying to use structured logging by logging in my Azure Function like this: log.LogError("Failed to get object. ({customerId}, {objectId}, {errorMessage})", request.CustomerId, request.ObjectId, errorMessage); My Azure…
2
votes
0 answers

How to import StructuredArgument for structured logging in scala using slf4j and logback

This is probably a stupid question, but my scala knowledge is a bit lacking. I'm trying to implement structured logging in scala, and we're using slf4j/logback/logstash. I came across the following post: How does SLF4J support structured logging…
Andy
  • 3,228
  • 8
  • 40
  • 65
2
votes
2 answers

Google StackDriver correlating logs with parent request python 3

In python 2.7, the app engine sdk was doing the work in the background to nest all logs with the parent request to have a correlation in Google StackDriver. As of the transition to python 3, it is through the usage of google cloud logging or…
2
votes
2 answers

Saving structured logs in RavenDB

I’m writing .NET Core application and would like to use structured logging available in .NET Core Logging Extensions to write logs in more structured way. I want to save my logs in RavenDB and I’m wonder are there any best practices for use case…
dnf
  • 1,659
  • 2
  • 16
  • 29
2
votes
1 answer

How can I make a full-text search through AWS Cloudwatch?

I use structured logging (hence: logging json strings) and I use a log identifier. So in my code, each log message has a unique identifier so that I can search in both directions: When I see a log message, I know where it comes from and when I…
2
votes
1 answer

Writing structured logs with Serilog

I tried the following log with Serilog: this.logger.Debug("Incoming metrics data {ClientId}", new { clientid = 54732 }); Serilog produced this output: Incoming metrics data "{ clientid = 54732 }" Serilog being a structured logger I've expected it…
dstr
  • 8,362
  • 12
  • 66
  • 106
1
vote
1 answer

How do I get JSONObject as a StructuredArgument in a LogStashEncoder logback output?

I am using logback and LogstashEncoder to write JSON format logging to the console. I am using StructuredArguments to pass the objects I want in the log from my code to the logger. However my JSONObject is not appearing as a structured object in the…
JohnXF
  • 972
  • 9
  • 22
1
vote
0 answers

How to temporarily disable/mute logging using Zap logger in Go

How to temporarily disable logging using Zap logger in Go. I need to mute logs for a particular function without removing logger print statements. I need a solution similar to what we do for fmt as below, temp := os.Stdout os.Stdout =…
Gopi Kumar
  • 53
  • 5
1
vote
1 answer

Two message templates required when structured logging exception message text

How can I avoid this pattern? I wish to capture an illegal state, such as found in the contrived example below. Log a structured message followed by throwing an exception containing the same message. public async Task DoSomeWork(int numerator,…
1
vote
0 answers

Higher order inline functions, and MDCContext

So I'm trying to write a higher order function that adds Mapped Diagnostic Context (MDC) to a closure that is passed as parameter. There are two ways to make it work. One for non suspending functions (MDC.put) and one for suspending functions…
caeus
  • 3,084
  • 1
  • 22
  • 36
1
vote
0 answers

In NLog fluent logging, how can I force a log property to be rendered as JSON?

I'm using NLog to create semantic logs in a Seq server. I want to log an object that has a ToString() method that produces a short human readable summary of the data content. So I want to render the object as a string when formatting it using the…
Tim Long
  • 13,508
  • 19
  • 79
  • 147
1
vote
1 answer

Structured logging using Loki

Is it possible to do structured logging using Loki? If yes, what should be the best practices to do this? Currently I am sending my logs in Loki as plain text or unstructured logs. Any help would be appreciated
Awadesh
  • 3,530
  • 2
  • 20
  • 32
1
vote
1 answer

How to conditionally render an attribute with NLog and structured logging?

I have inherited an ASP.NET application which is using NLog for logging. One of the logged attributes is named module which is hardcoded to "Core". This is not useful at all, because all parts of the application (e.g. health check, various business…
Alexei - check Codidact
  • 22,016
  • 16
  • 145
  • 164
1
vote
1 answer

Get original property value type from ILogEventPropertyFactory

I'm writing the simplest of enrichers: find all properties XProperty that have enum value types and add another property named XPropertyString which is the string representation of the Enum value. I started with something like this: public class…
Theodore Zographos
  • 2,215
  • 1
  • 24
  • 23
1
vote
1 answer

NLog structured logging with duplicate hole names

I'm trying to figure it out what is a correct behaviour for capturing properties with duplicate hole names according message templates syntax which is implemented in the NLog. Let's look an example. Record to console with duplicate hole names but…
Alexcei Shmakov
  • 2,203
  • 3
  • 19
  • 34