1

I am using AWS Lambda functions that log to Cloudwatch. However, I prefer Google Stackdriver's logging features. How can I export the logs from Cloudwatch to Stackdriver? I know I can export them to S3, but then what? Do I have to write an ETL script to send them to Stackdriver?

I don't want to use the Stackdriver logging packages in my code itself, as the lambda will likely finish before the logs have been sent to Stackdriver.

skunkwerk
  • 121
  • 2
  • 2
    You can trigger a lambda by CloudWatch logs directly and then to call StackDriver client logging library: http://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/Subscriptions.html , https://cloud.google.com/logging/docs/reference/libraries#client-libraries-install-python , https://cloud.google.com/logging/docs/api/tasks/creating-logs#logging-write-log-entry-python – dsmsk80 Jun 20 '17 at 12:20
  • 3
    @skunkwerk if you were able to solve this issue it is recommended to post your answer as the solution here to better help the community. – Jordan Sep 29 '17 at 18:36
  • Another user on SoF asked a similar question. [How to send Lambda logs to StackDriver instead of CloudWatch?](https://stackoverflow.com/questions/58785818/how-to-send-lambda-logs-to-stackdriver-instead-of-cloudwatch) – Bruno Aug 21 '20 at 17:39

1 Answers1

1

Pasting an answer from the last comment link for better usability:

Stackdriver supports the metric types from Amazon Lambda listed in this article

To use these metrics in charting or alerting, your Google Cloud Platform project or AWS account must be associated with a Workspace.

After you have a Workspace, you can add more GCP projects and AWS accounts to it using the Adding monitored projects instructions.

If you plan to monitor more than just your host project, then the best practice is to use a new, empty GCP project to host the Workspace and then to add the projects and AWS accounts you want to monitor to your Workspace. This lets you choose a useful name for your host project and Workspace, and gives you a little more flexibility in moving monitored projects between Workspaces. The following diagram shows Workspace W monitoring GCP projects A and B and AWS account D:

enter image description here

Monitoring creates this AWS connector project when you add an AWS account to a Workspace. The connector project has a name beginning with AWS Link, and it has the same parent organization as the Workspace. To get the name and details about your AWS connector projects, go to the Inspecting Workspace section.

In the GCP Console, AWS connector projects appear as regular GCP projects. Don't use connector projects for any other purpose, and don't delete them while your Workspace is still connected to your AWS account.

Wojtek_B
  • 1,013
  • 4
  • 14