【问题标题】:Terraform cloudwatch_log_metric_filter - technique to filter to specific stream prefix?Terraform cloudwatch_log_metric_filter - 过滤到特定流前缀的技术?
【发布时间】:2021-07-12 13:28:57
【问题描述】:

提出问题以确保我没有错过任何东西。当使用 Terraform 的 cloudwatch_log_metric_filter 时,并且您有一个包含许多流的日志组,有没有办法过滤到特定的日志流前缀?

谢谢!

参考:

https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_log_metric_filter

resource "aws_cloudwatch_log_metric_filter" "yada" {
  name           = "MyAppAccessCount"
  pattern        = "_special_logstream_prefix_filter_pattern_???"
  log_group_name = aws_cloudwatch_log_group.dada.name

  metric_transformation {
    name      = "EventCount"
    namespace = "YourNamespace"
    value     = "1"
  }
}

【问题讨论】:

  • 我认为 Cloudwatch Logs 指标过滤器无法实现该功能。如果您不这么认为,您能否分享一个指向 AWS 文档的链接,了解如何在没有 Terraform 的情况下对其进行配置?

标签: terraform terraform-provider-aws


【解决方案1】:

有没有办法过滤到特定的日志流前缀?

没有。您在代码中正确执行此操作,因为过滤器功能可以应用于日志组级别,而不是日志流级别。

【讨论】:

    猜你喜欢
    • 2022-01-26
    • 1970-01-01
    • 2011-10-22
    • 2019-02-04
    • 2015-08-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-11-13
    相关资源
    最近更新 更多