What could cause this situation?
The Lambda function does not have any explicit log statements for the log data to send it to CloudWatch Logs.
The Lambda function is missing CloudWatch Logs as a source trigger to send log data.
The execution role for the Lambda function is missing permissions to write log data to the CloudWatch Logs.
The Lambda function is missing a target CloudWatch Log group.
Explanations:
If the Lambda function does not have explicit log statements (e.g.,console.logfor Node.js), no log data will be generated, but this does not explain why CloudWatch Logs isn’t receiving any logs. CloudWatch logs should still be created automatically even if no explicit log statements are present, as long as the function has the correct permissions.
CloudWatch Logs is automatically integrated with Lambda functions. A separate trigger is not required to send logs to CloudWatch, as long as the Lambda function has appropriate permissions.
The Lambda function needs permissions to write log data to CloudWatch Logs. If the execution role does not include the necessary permissions (e.g.,logs:CreateLogGroup,logs:CreateLogStream, andlogs:PutLogEvents), logs will not be generated in CloudWatch Logs.
The Lambda function does not need a specific CloudWatch Log group as a target. If the permissions are correctly configured, the function will automatically create a log group and stream in CloudWatch Logs based on its name.