1

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.

  • 3
    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. – John Hanley Jul 20 '19 at 1:04
1

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:

https://cloud.google.com/logging/docs/export/bigquery

https://cloud.google.com/logging/docs/structured-logging

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.