It seems that I have a delay with the CloudWatch log of one of my lambda function's. I have a lambda function that gets triggered by a Kinesis stream. The lambda function writes records into a DynamoDB table.
I know for sure that the lambda function gets executed since I see new records in the DynamodDB table. But the CloudWatch log doesn't get updated. I waited for almost an hour and there is no update.
Also, permissions are good since I have older records in my log.
Any idea ?
Lambda automatically integrates with CloudWatch Logs and pushes all logs from your code to a CloudWatch Logs group associated with a Lambda function, which is named /aws/lambda/ <function name> .
The AWSLambdaBasicExecutionRole managed policy contains the following statement that allows our function to log to CloudWatch: In the browser tab of the lambda function, click on the Monitor tab and select View logs in CloudWatch Click on the most recent log stream and you should see the logs of your lambda function
You can view logs for Lambda functions using the Lambda console, the CloudWatch console, the AWS Command Line Interface (AWS CLI), or the CloudWatch API. This page describes how to view logs using the Lambda console.
You can insert logging statements into your code to help you validate that your code is working as expected. Lambda automatically integrates with CloudWatch Logs and pushes all logs from your code to a CloudWatch Logs group associated with a Lambda function, which is named /aws/lambda/ <function name> .
CloudWatch does sometimes have a slight delay, but if you've waited an hour, it probably isn't going to show up. Double-check permissions to ensure they haven't changed. From the Lambda Management Console, do you still see "Amazon CloudWatch Logs" on the right as seen in the picture below?
If not, double check your security policy to make sure you have allowed CreateLogGroup, CreateLogStream, and PutLogEvents. Here is a snippet of a policy that includes the appropriate permissions.
"Statement": [
{
"Effect": "Allow",
"Action": [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents"
],
"Resource": "arn:aws:logs:*:*:*"
}
]
Hope this helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With