Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stackdriver stdout log message severity

I am using a none supported language on GCP.

Stackdriver logging is great it collects my stdout logs which is most excellent.

However I can't seem to set a severity.

All the documentation pages seem to revolve around sending whole logs.

I would like to know what a message needs to look like when sending it to stdout so it picks up on the severity. An Example would be amazing.

like image 349
abe Avatar asked Dec 08 '25 01:12

abe


1 Answers

There appears to be some quite good documentation on writing stdout/stderr output from your apps and how this translates to Stackdriver output found here.

If you write a JSON string to output the structure will be parsed.

Documentation on special fields can be found here.

In summary,

  • severity
    • DEFAULT
    • DEBUG
    • INFO
    • NOTICE
    • WARNING
    • ERROR
    • CRITICAL
    • ALERT
    • EMERGENCY
  • message
  • log
  • ... others

The content of your output will appear in the jsonPayload field of the Stackdriver record entry.

An example sent to stdout might be:

{
  "severity": "NOTICE",
  "message": "Hello World!",
  "additional-part": "More Data!"
}
like image 70
Kolban Avatar answered Dec 11 '25 21:12

Kolban



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!