简体   繁体   English

如何在Cloudformation模板中为AWS Lambda定义MetricFilter?

[英]How to define MetricFilter for AWS Lambda inside Cloudformation template?

I experiment with AWS::Logs::MetricFilter and encountered a small problem I cannot resolve. 我尝试使用AWS :: Logs :: MetricFilter并遇到了一个我无法解决的小问题。 In my Cloudformation template I try to configure it like so: 在我的Cloudformation模板中,我尝试像这样配置它:

  SomeMetricFilter:
    Type: "AWS::Logs::MetricFilter"
    Properties:
      FilterPattern: "*thing just happened*"
      LogGroupName: "/aws/lambda/some-lambda-name-ISW1N3LSLNK0"
      MetricTransformations:
        -
          MetricValue: "1"
          MetricNamespace: "Name/Space"
          MetricName: "VeryVerboseMetricName"

LogGroups created for this AWS Lambda has a string of random letters and numbers as a prefix: ISW1N3LSLNK0 为此AWS Lambda创建的LogGroup具有一串随机字母和数字作为前缀:ISW1N3LSLNK0

Which makes it impossible to configure the Filter at this stage. 这使得在此阶段无法配置过滤器。 Maybe someone could help me out and tell me how to work this thing around? 也许有人可以帮助我,告诉我如何解决这个问题?

This was a silly one. 这是一个愚蠢的。 I just have to define a name for the lambda function like: 我只需要为lambda函数定义一个名称,例如:

  FunctionName: !Sub "some-function-name"

And then the log group will have the same name. 然后,日志组将具有相同的名称。

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

相关问题 如何将 AWS Lambda 转换回 CloudFormation 模板 - How to convert AWS Lambda back into CloudFormation template 如何为使用 CloudFormation 模板创建的 AWS Lambda function 添加触发器? - How to add triggers for a AWS Lambda function created using a CloudFormation template? 如何在CloudFormation模板中描述AWS Lambda函数测试事件? - How to describe AWS Lambda function test events in CloudFormation template? 如何使用 CloudFormation 模板更新 AWS Lambda function - How do I update AWS Lambda function using CloudFormation template 通过Cloudformation模板将Lambda目标与AWS ALB - AWS ALB with lambda target through Cloudformation Template 如何定义 AWS MetricFilter FilterPattern 以匹配 CloudWatch 中的 JSON 格式的日志事件? - How do I define an AWS MetricFilter FilterPattern to match a JSON-formatted log event in CloudWatch? AWS SAM/CloudFormation 模板 Lambda 删除保护 - AWS SAM/CloudFormation Template Lambda Delete Protection AWS Cloudformation:是否可以在Cloudformation模板中访问用户ID? - AWS Cloudformation: Is it possible to access user id inside a Cloudformation template? 如何使用cloudformation模板传递aws-lambda函数名称以生成cloudwatch警报 - How to pass aws-lambda function name to generate a cloudwatch alarm using cloudformation template 如何在CloudFormation模板中为嵌套堆栈定义名称? - How to define the name for a nested stack in CloudFormation template?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM