ovhemert / pino-stackdriver

🌲A transport for pino that sends messages to Google Stackdriver Logging
MIT License
62 stars 21 forks source link

separate formatting from API calls #6

Closed derhuerst closed 5 years ago

derhuerst commented 5 years ago

I'd like to use pino with Stackdriver-compatible logging. In many Google Cloud environments, stdout will appear in Stackdriver automatically, so I only need the output in the right format. This would match a major design decision behind pino: That the logging process shouldn't care about the transport.

I propose a way to use pino-stackdriver without making calls to the Stackdriver API (for performance and separation of concerns), and without requireing @google-cloud/logging (for faster startup times).

ovhemert commented 5 years ago

Are you referring to the Stackdriver Logging agent? It's based on fluentd and has some log types pre-configured.

If you are running your application on Google Cloud, you can also try pino-syslog. It will transform pino log format to syslog format, which is supported by the logging agent.

This library is useful if you want to log to Stackdriver, but the application is not running on Google Cloud. Therefore it will use the API.

If these are not the case, tell me about your setup. If we can write to stdout in a different format, we can create another version of this library that will not use the API, but write out in a different format.

derhuerst commented 5 years ago

Ah, then I misinterpreted the goal of this library.

Are you referring to the Stackdriver Logging agent? It's based on fluentd and has some log types pre-configured.

Yes. I didn't know its name, just that the logs of containers via Google Kubernetes Engine, Cloud Functions, etc. show up in Stackdriver anyways.