简体   繁体   English

当我们从s3触发lambda函数时。 如何获取lambda被触发的日志。 我想用terraform做这个

[英]when we trigger lambda function from s3. how to get the logs that lambda is triggred or not. i want to do this with terraform

Need to get output when trigger lambda function from s3. 从s3触发lambda函数时需要输出。 need to know whether lambda function is triggered or not. 需要知道是否触发了lambda函数。 I can check in the console but need to be done with the terraform 我可以检查控制台,但需要完成terraform

I tried with resource "aws_cloudwatch_metric_alarm" but no I don't know weather lambda triggered or not 我试过资源“aws_cloudwatch_metric_alarm”,但不知道我不知道天气lambda是否被触发

If you don't get an alarm notification then this means that your Lambda executed without any issues. 如果您没有收到警报通知,那么这意味着您的Lambda执行没有任何问题。 That's the whole point of alarms: To be notified when things go wrong. 这就是警报的全部要点:在出现问题时通知。 So you should test your lambda and see if the errors are reported in "Monitoring", check if the alarm is triggered and the notifications sent. 因此,您应该测试您的lambda并查看是否在“监控”中报告了错误,检查是否触发了警报并发送了通知。 In addition you can trigger notifications when your alarm goes from alarm to normal 此外,您可以在闹钟从闹钟变为正常时触发通知

You could send an SNS notification at the end of your Lambda code, but this approach would be cumbersome, as you would have to figure what' missing. 您可以在Lambda代码的末尾发送SNS通知,但这种方法很麻烦,因为您必须弄清楚丢失的内容。

Setting up your Lambda and the alarms with Terraform is another task You should come up with specific questions about this. 使用Terraform设置Lambda和警报是另一项任务您应该提出有关此问题的具体问题。 What you've tried and what does not work. 你尝试了什么,什么不起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何确保 Lambda function 在部署后的每个 S3 Put Trigger 上写入 Cloudwatch 日志? - How do I ensure that a Lambda function writes to Cloudwatch Logs on every S3 Put Trigger after deploy? 如何在CloudFormation中添加带有S3触发器的Lambda函数? - How do I add a Lambda Function with an S3 Trigger in CloudFormation? 如何使用来自 AWS Lambda Error 日志的错误信息触发 Lambda - How to trigger a Lambda with error info from AWS Lambda Error in logs 创建 S3 存储桶时触发 Lambda function - Trigger Lambda function when S3 buckets get created 如何从 Lambda function 访问 S3 object? - How do I access an S3 object from a Lambda function? 如何从 aws lambda 调用中获取完整日志? - How do I get full logs out of aws lambda invoke? 从 S3 中删除 object 时触发 Lambda function - Trigger Lambda function when object is deleted from S3 如何在 Lambda function 中获取 S3 触发器详细信息? - How to get S3 trigger details inside Lambda function? 如何从在 AWS Lambda 函数中运行的 Docker 映像获取日志? - How to get logs from Docker image running in AWS Lambda function? 使用 Terraform 部署 Lambda 函数时,为什么会出现“错误:当 PackageType 为 Zip 时必须设置处理程序和运行时”? - Why do I get "Error: handler and runtime must be set when PackageType is Zip" when deploying a Lambda function using Terraform?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM