Questions tagged [structured-logging]

47 questions
26
votes
3 answers

Can structured logging be done with Pythons standard library?

I recently read about structured logging (here). The idea seems to be to log not by appending simple strings as a line to a logfile, but instead JSON objects. This makes it possible to analyze the logfile by automatic tools. Can Pythons logging…
Martin Thoma
  • 124,992
  • 159
  • 614
  • 958
23
votes
6 answers

How does SLF4J support structured logging

Anyone knows how structured logging is usually implemented with SLF4J? Is there any open source already out there handling this?
Alfred
  • 1,709
  • 8
  • 23
  • 38
8
votes
2 answers

Is it possible to use NLog's structured logging without having templated messages?

Until today we have used NLog version 4.4.12 (without structured logging). However we were using https://www.nuget.org/packages/NLog.StructuredLogging.Json/ for structured logging. The nice thing about using this extension is that you do NOT need to…
toebens
  • 4,039
  • 6
  • 24
  • 31
7
votes
1 answer

How to add a parameter to .Net Core structured logging without referencing it in a message?

I can do this in .net core _logger.LogInformation("Token validated {clientId}", "MyId"); And then logging libraries like NLog will know that there is a property called clientId with the value MyId in the message and can render it in a special…
Ilya Chernomordik
  • 27,817
  • 27
  • 121
  • 207
5
votes
0 answers

How to handle field collisions from different logging sources in Elasticsearch?

We send logs from a variety of services running in a Kubernetes cluster to Elasticsearch via Filebeat. Some of these services we develop ourselves, others are third-party. We use dynamic mapping in our indices. We've hit an issue where sometimes a…
Matt R
  • 9,892
  • 10
  • 50
  • 83
4
votes
1 answer

How to show log message with substituted parameters in structured logging output from Serilog on AWS Cloudwatch

I'm using AWS Cloudwatch for my application logging. I recently learned that I could use structured logging to make my logs more searchable. I did a little research and decided to go with Serilog for my logging tool. One difficulty I'm having is,…
omatase
  • 1,551
  • 1
  • 18
  • 42
4
votes
2 answers

python logging - With JSON logs can I add an "extra" value to every single log?

I'm using the python logging module, along with python-json-logger and I would like to add a few keys: { "app_name": "myapp", "env": "prod" } To all of my logs automatically without doing the following. logger.info("Something happened",…
nackjicholson
  • 4,557
  • 4
  • 37
  • 35
4
votes
1 answer

How to include multiple JSON fields when using JSON logging with SLF4J?

I'm working with Dropwizard 1.3.2, which does logging using SLF4J over Logback. I am writing logs for ingestion into ElasticSearch, so I thought I'd use JSON logging and make some Kibana dashboards. But I really want more than one JSON item per log…
Evan Reynolds
  • 450
  • 3
  • 11
4
votes
0 answers

Sumo Logic: Structured Logging Support?

Does Sumo Logic support structured logging (.ie message templates, message template hashing, property mapping, etc)? This is supported by Seq and Splunk, but so far all I see is the ability to log as JSON and use the json pipe to manipulate it...
Sheldon Cooper
  • 627
  • 4
  • 15
3
votes
1 answer

ILogger not returning Message and Object in JSON format

Im trying to use ILogger the following way, _logger.LogInformation("Logging info {someClass}", someClass); But the output is just the object name. What am I doing wrong here ?
Sharthak Ghosh
  • 576
  • 1
  • 9
  • 22
3
votes
2 answers

Structured logging with Common.Logging and NLog

I have the latest version of Common.Logging (3.4.1) and NLog (4.5.11) in my project. Instructions were followed to tie up Common.Logging with NLog in the app.config, and logging now works. Now I want to have structured logging: private static…
Michel van Engelen
  • 2,791
  • 2
  • 29
  • 45
2
votes
0 answers

How to use NLog structured logging when a object has a property with an exception?

I am trying to use structured logging and log an object. I run into this error when trying to log the object: System.IO.FileNotFoundException: 'Could not find file 'C:\Non-Existent-File'.' This exception is in the FileInfo Length property. Is there…
JasonC
  • 139
  • 8
2
votes
0 answers

formatting "gcloud app logs tail" output for structured logs (single line of serialized JSON) in pretty text

I am trying to do structured logging simply with JUL and console handler. As mentioned in google's official documentation https://cloud.google.com/run/docs/logging#using-json I am using single line of serialized JSON with severity and message JSON…
2
votes
0 answers

ElasticSearch's dynamic index mapping dropping logs due to poor field names

I have a semi-large project that has been using nlog, and throughout I re-used alot of field names for different datatypes. I started to send my logs (including all log properties/fields) to ElasticSearch, and now its starting to haunt me. I noticed…
ZZT
  • 71
  • 1
  • 6
2
votes
1 answer

NLog Database Parameter + .NET Core: all-event-properties in JSON?

I am using the Database target and trying to figure out a way to send all-event-properties as a parameter in JSON format; I see that parameter includes a property for "format," but when I do format="json" it doesn't produce the desired…
codeMonkey
  • 4,134
  • 2
  • 31
  • 50
1
2 3 4