googleapis / nodejs-logging-winston

Node.js client integration between Stackdriver Logging and Winston.
https://cloud.google.com/logging/
Apache License 2.0
105 stars 50 forks source link

adds pointless `projects/{{projectId}}/logs/winston_log` property to logs when `redirectToStdout` is set to `true` #785

Closed macrozone closed 10 months ago

macrozone commented 1 year ago

Environment details

Steps to reproduce

  1. create the following log:

const googleCloudLogger = new LoggingWinston({
  redirectToStdout: true,
})
  1. deploy to cloud run
  2. logs will then look like this:
Bildschirm­foto 2023-02-28 um 15 15 35

you notice that it adds an additional logName property projects/{{projectId}}/logs/winston_log which adds noise to it and is even the first thing you see and therefore makes it hard to read the logs.

you also see that the real correct logName is also visible one level above

fairojm commented 1 year ago

If we use useMessageField option set to false then logs are appearing fine in cloud run.

pebo commented 1 year ago

If we use useMessageField option set to false then logs are appearing fine in cloud run. Are you using redirectToStdout: true? I get the logName added when using:

redirectToStdout: true,
useMessageField: false,
cindy-peng commented 10 months ago

Hi @macrozone , could you try useMessageField and see if you are still running into this? useMessageField is used to control if "message" field is used to store structured, non-text data inside jsonPayload field when redirectToStdout is set.

cindy-peng commented 10 months ago

Closing issue as setting useMessageField to false will solve the issue here.

evil-shrike commented 4 weeks ago

I'm having the same issue with useMessageField: false and redirectToStdout: true. image

evil-shrike commented 4 weeks ago

please re-open