Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable CloudWatch to monitor logs for Lambda function

Is there any possible way to disable CloudWatch to log Lambda Function's events? If possible, then what are the steps to do this.

like image 944
Richa Sharma Avatar asked Sep 05 '25 03:09

Richa Sharma


2 Answers

There is no flag/toggle/switch or a direct way to disable the CloudWatch logs for a lambda function. One workaround is you can add the following inline policy to your role to disable the CloudWatch logs.

{
"Version": "2012-10-17",
"Statement": [
    {
        "Effect": "Deny",
        "Action": [
            "logs:CreateLogGroup",
            "logs:CreateLogStream",
            "logs:PutLogEvents"
        ],
        "Resource": [
            "arn:aws:logs:*:*:*"
        ]
    }
  ]
}

You can change the "Deny" to "Allow" when you require logging again.

See for more details.

like image 152
Vijay Avatar answered Sep 07 '25 21:09

Vijay


As per my understanding log output is generated by as a default behavior if you do any tests with lambda function. However, the logs are stored in CloudWatch log group only if your lambda role has permission to write to CloudWatch.

like image 42
lohith Avatar answered Sep 07 '25 21:09

lohith