nodejs-logging-winston icon indicating copy to clipboard operation
nodejs-logging-winston copied to clipboard

How to use @google-cloud/logging-winston within AWS lambda?

Open rr923 opened this issue 2 years ago • 1 comments

  • What you're trying to do I want to use @google-cloud/logging-winston to send logs to GCP logging within AWS lambda.

  • What code you've already tried

const gcpLoggingWinston = new LoggingWinston({
  projectId: "my_project_id",
  keyFilename: "/tmp/key.json",
  defaultCallback: (err: any) => {
    if (err) {
      console.error("gcp_logging error occured: " + err);
    }
  },
});

I saved the service account key to /tmp/key.json, since /tmp is the folder available for AWS lambda, and passed the file name to keyFilename.

  • Any error messages you're getting When running locally (dev environment), log works; but after being deployed, logs never received. And I haven't seen any error messages also. Since I have verified the file /tmp/key.json do exist, so what could be the cause of this issue? Is it possible to just provide the json content, instead of the file name? Or is there any other way to send logs to GCP logging from AWS lambda?

rr923 avatar Jun 09 '23 08:06 rr923

Hi @rr923 , just want to follow up, are you still running into this issue?

cindy-peng avatar Jan 09 '24 19:01 cindy-peng

Closing this for now since we need more information. Please feel free to re-open it if you are still running into this. Thank you!

cindy-peng avatar Jul 03 '24 17:07 cindy-peng