简体   繁体   English

AWS CloudWatch - 日志组不存在

[英]AWS CloudWatch - Log group does not exist

I'm getting this error message when trying to see the log file in AWS CloudWatch for my AWS Lambda function.尝试在 AWS CloudWatch 中查看我的 AWS Lambda 函数的日志文件时收到此错误消息。

An error occurred while describing log streams.
The specified log group does not exist.

Log group does not exist
The specific log group: /aws/lambda/xxxxx does not exist in this account or region.

By the way, I'm using the Singapore region.顺便说一下,我使用的是新加坡地区。

Make sure that your Lambda function's execution role has sufficient permissions to write logs to CloudWatch, and that the log group resource in the IAM policy includes your function's name.确保您的 Lambda 函数的执行角色具有将日志写入 CloudWatch 的足够权限,并且 IAM 策略中的日志组资源包含您的函数名称。

In the IAM console, review and edit the IAM policy for the execution role to make sure that:在 IAM 控制台中,查看并编辑执行角色的 IAM 策略以确保:

  • The write actions CreateLogGroup and CreateLogStream are allowed.允许写入操作 CreateLogGroup 和 CreateLogStream。 You should attach these policies in the IAM roles of the Lambda function您应该在 Lambda 函数的 IAM 角色中附加这些策略

Note: If you don't need custom permissions for your function, you can attach the managed policy AWSLambdaBasicExecutionRole, which allows Lambda to write logs to CloudWatch.注意:如果您的函数不需要自定义权限,您可以附加托管策略 AWSLambdaBasicExecutionRole,它允许 Lambda 将日志写入 CloudWatch。

  • The AWS Region specified in the Amazon Resource Name (ARN) is the same as your Lambda function's Region. Amazon 资源名称 (ARN) 中指定的 AWS 区域与您的 Lambda 函数的区域相同。

  • The log-group resource includes your Lambda function name.日志组资源包括您的 Lambda 函数名称。 For example, if your function is named myLambdaFunction, the log-group is /aws/lambda/myLambdaFunction.例如,如果您的函数名为 myLambdaFunction,则日志组为 /aws/lambda/myLambdaFunction。

Here is an example of the permissions in the JSON format以下是 JSON 格式的权限示例

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": "logs:CreateLogGroup",
            "Resource": "arn:aws:logs:region:accountId:*"
        },
        {
            "Effect": "Allow",
            "Action": [
                "logs:CreateLogStream",
                "logs:PutLogEvents"
            ],
            "Resource": [
                " arn:aws:logs:region:accountId:log-group:/aws/lambda/functionName:*"
            ]
        }
    ]
}

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

相关问题 aws logs:指定的日志组不存在 - aws logs: The specified log group does not exist 是否可以重命名AWS CloudWatch日志组? - Is it possible to rename an AWS CloudWatch Log Group? 登录存在于 AWS cloudwatch 中,但不返回日志 - Logs in exist in the AWS cloudwatch but does not return the logs AWS Cloudformation SubscriptionFilter 指定的日志组不存在错误 - AWS Cloudformation SubscriptionFilter The specified log group does not exist error 使用aws lambda时日志组不存在错误 - Log group does not exist error when using aws lambda 将 AWS CloudWatch 日志组流式传输到多个 AWS Elasticsearch 服务 - Stream AWS CloudWatch Log Group to Multiple AWS Elasticsearch Services 为什么无法更改AWS CloudWatch日志组和流名称? - Why AWS CloudWatch Log Group and Stream Name cannot be changed? 将日志从 AWS Cloudwatch 日志组发送到 Opendistro EFK - Ship logs from AWS Cloudwatch log group to Opendistro EFK 使用 Terraform 将 AWS Lambda 日志写入 CloudWatch 日志组 - Write AWS Lambda Logs to CloudWatch Log Group with Terraform 使用 EKS 中的流利位在 AWS cloudwatch 中自动创建日志组 - Automatic log group creation in AWS cloudwatch using fluent bit in EKS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM