如何在 EKS(即 emr-containers)上为 EMR 获取日志记录

how to get logging working for EMR on EKS (i.e. emr-containers)

我正在尝试在 EKS 上使用 EMR 进行日志记录 (a.k.a.emr-containers)。

我正在使用这个配置:

    "monitoringConfiguration": {
      "cloudWatchMonitoringConfiguration": {
        "logGroupName": "/emr-containers/jobs", 
        "logStreamNamePrefix": "demo"
      }, 
      "s3MonitoringConfiguration": {
        "logUri": "s3://my-bucket/my-prefix"
      }

我的执行角色是正确的:

  policy = jsonencode({
    "Version": "2012-10-17",
    "Statement": [
      {
        Effect: "Allow",
        Action: [
          "s3:PutObject",
          "s3:GetObject",
          "s3:ListBucket"
        ],
        Resource: "*"
      },
      {
        Effect: "Allow",
        Action: [
          "logs:PutLogEvents",
          "logs:CreateLogStream",
          "logs:DescribeLogGroups",
          "logs:DescribeLogStreams"
        ],
        Resource: [
          "arn:aws:logs:*:*:*"
        ]
      }
    ]
  })

但是我看cloudwatch,这个日志组什么都没有,同样我看S3,也没有。

作业是成功还是失败并不重要——在所有情况下都没有日志保存到 cloudwatch 或 s3。

有什么建议吗?

能否查看运行在job-runner、driver和executor中的fluentd side car容器的日志pods?这将是一个很好的起点。

您的作业执行角色具有适用于 S3 和 Cloudwatch 的适当策略,因此请确保您 update the trust policy of the execution role 以便 EKS 集群可以承担该角色。

最后,您应该确认您已完成 EKS 集群 enable IRSA 的步骤。