Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stackdriver logging from node with stdout/stderr

On Google Cloud, when using a GAE or a cloud function in nodejs, we can log to stackdriver directly via stdout, as they explain here as follows:

Note: Logs written to stdout and stderr are automatically sent to Stackdriver Logging for you, without needing to use the Stackdriver Logging libraries for Node.js.

Is it possible to add structure to these logs? Like jsonPayload? I would love to avoid client libraries, if possible.

like image 692
Pinguin Dirk Avatar asked Sep 04 '18 12:09

Pinguin Dirk


1 Answers

App Engine and Cloud Functions both listen to std and can directly log to Stackdriver. The recommended approach for further customization is to directly use the client library instead of logging to std. For now, you can add structure to your Stackdriver logging using the jsonPayload field but the call will still need to go through the client libraries. Please check the following article for reference. I have already created a feature request for you on Google Issue Tracker so that it might help you get the feature that you have requested.

like image 124
Sami Islam Avatar answered Sep 29 '22 08:09

Sami Islam