Server Fault Asked by Goldstein on August 13, 2020
We have an in-house Java application created by our developers that uses log4j
to format its logging messages. Recently, we’ve started to run this on Google Kubernetes Engine and so logs are piped through to Stackdriver from stdout automatically. However, all logs appear with the severity level INFO
. One such message has a textPayload that begins like this:
18 Jul 2019 10:11:32.334 [ERROR] [req=api-test--870259294-18071111-11 sess=cwfscqttcfqh1acsictx3toxv reqMs=4]
It’s clearly the developers’ intent that this is an ERROR
severity message, but because they haven’t built their application with Stackdriver in mind it’s unstructured and reported as an INFO
severity.
It feels wrong to have to change the application to respect the centralised logging we use; our clients might use other logging solutions. Is there any way to get Stackdriver to use the textPayload in order to determine the severity? I’m running on Google Kubernetes Engine so I haven’t set up any of the logging infrastructure and don’t have any access to it beyond what Google will provide.
I’m interested in making this change because Google Cloud Platform’s Error Reporting is a powerful tool for tracking error messages, but it rightly applies only to logs that are of an ERROR
severity or higher. Simply creating a metric over the logs in Stackdriver won’t give me the control I want.
The quick answer is No, you will need to change your code and implement proper logging with the correct severity for each message. You could export your Stackdriver logs to BigQuery, which is normal to do, and then run more complex queries.
Here you can find some helpful links:
Answered by KoopaKiller on August 13, 2020
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP