1

Can anyone suggest how to make stackdriver parse logs to json payload. Logs in stackdriver from application running in GKE are considered as textpayload, even if they are in json format. What are the points parser consider to mark log as textpayload or json payload?

Example in the below image the log message from application is in json with severity=error. Still, it is considered a text payload. Also, severity is marked as INFO even if error message and error severity.

So how to update my logs so that they are treated as jsonpayload instead of a textpayload.

enter image description here

Ivan Aracki
  • 4,861
  • 11
  • 59
  • 73
ss2712
  • 31
  • 5
  • Please update your question with more details and clarify it - it's not clear what's your goal here ? Is there anything specific you want to do ? – Wojtek_B Oct 07 '21 at 10:54
  • @Wojtek_B I have updated the question and added a image for reference – ss2712 Oct 07 '21 at 13:21
  • Do I understand correct that you're running app on a VM running in Kubernetes Engine ? – Wojtek_B Oct 08 '21 at 12:32
  • Yes , the application is running on VM running in GKE – ss2712 Oct 08 '21 at 16:07
  • I've found [this answer]https://stackoverflow.com/a/65472970/12257250) thay may help you - it tells how to configure `fluentd` logging agent so it will send json logs - doest this work for you ? – Wojtek_B Oct 11 '21 at 13:54

1 Answers1

0

First check that your GKE clusters are using the default cluster logging and monitoring setup as described here: https://cloud.google.com/stackdriver/docs/solutions/gke/managing-logs

Google Cloud Logging supports Structured Logging and has various ways to send these logs. For recognizing JSON logs collected from stdout, ensure that it follows the schema found in the documentation: https://cloud.google.com/logging/docs/structured-logging

Mani Gandham
  • 7,688
  • 1
  • 51
  • 60