[英]How do I get the log group name and ARN of a lambda generated by CloudFormation?
I'm generating a lambda in CloudFormation like this:我在 CloudFormation 中生成一个 lambda,如下所示:
TestFunction:
Type: AWS::Serverless::Function
Properties:
Handler: lib/test.handler
Timeout: 30
Role: !GetAtt ExecutionRole.Arn
Now, CloudFormation will automatically create me a log group for this lambda.现在,CloudFormation 会自动为我创建这个 lambda 的日志组。 How do I access that log groups name and ARN?
如何访问该日志组名称和 ARN?
I do NOT want to create a log group and then associate it to my lambda.我不想创建一个日志组,然后将其关联到我的 lambda。 I want to access the log group that is created for me automatically.
我想访问自动为我创建的日志组。
Log group created by a lambda function will have a name of the form /aws/lambda/<function name>
.由 lambda function 创建的日志组将具有
/aws/lambda/<function name>
形式的名称。 See here: https://docs.aws.amazon.com/lambda/latest/dg/monitoring-functions-logs.html请参阅此处: https://docs.aws.amazon.com/lambda/latest/dg/monitoring-functions-logs.html
You can construct the name of the log group with:您可以使用以下命令构造日志组的名称:
!Sub '/aws/lambda/${TestFunction}'
and the arn:和 arn:
!Sub 'arn:aws:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/lambda/${TestFunction}:*'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.