abe
abe

Reputation: 4146

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.

Upvotes: 3

Views: 2037

Answers (1)

Kolban
Kolban

Reputation: 15276

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!"
}

Upvotes: 5

Related Questions