- Newest
- Most votes
- Most comments
Hi Oleksii, Thank you for your answer but this not explain why I could not enter in the custom log group field my log group with the name : /aws/lambda/function. Regards Franck
Note that when configuring a custom log group, the name you select for your log group must follow the CloudWatch Logs naming rules. Additionally, custom log group names mustn't begin with the string aws/. If you create a custom log group beginning with aws/, Lambda won't be able to create the log group. As a result of this, your function's logs won't be sent to CloudWatch.
https://docs.aws.amazon.com/lambda/latest/dg/monitoring-cloudwatchlogs.html
By default, Lambda sends logs to a log group named /aws/lambda/<function name>. If you want your function to send logs to another group, you can configure this using the Lambda console, the AWS Command Line Interface (AWS CLI) or the Lambda API. See Configuring CloudWatch log groups to learn more.
You can configure multiple Lambda functions to send logs to the same CloudWatch log group. For example, you could use a single log group to store logs for all of the Lambda functions that make up a particular application. When you use a custom log group for a Lambda function, the log streams Lambda creates include the function name and function version. This ensures that the mapping between log messages and functions is preserved, even if you use the same log group for multiple functions.
The log stream naming format for custom log groups follows this convention:
YYYY/MM/DD/<function_name>[<function_version>][<execution_environment_GUID>]
Hello, Thank Oleksii for your help. But between I renamed my log group MyName to make it working, but I discover that CloudFront still want to create a log group in another country with /aws/lambda/us-east-1.<function name> even if my log group name is MyName and not /aws/lambda/MyName. So if it's help someone, when you want create your custom log group for several function with a name xxxx, to make CloudFront working correctly put that in your permission policy: { "Sid": "CreateLogs", "Effect": "Allow", "Action": [ "logs:CreateLogGroup" ], "Resource": [ "arn:aws:logs::<account_ID>:" ] }, { "Sid": "WriteLogs", "Effect": "Allow", "Action": [ "logs:CreateLogStream", "logs:PutLogEvents" ], "Resource": "arn:aws:logs::<account_ID>:log-group:" } You must put * instead of the us-east-1 region and you must end with log-group:* instead of the log group name, and then it works perfectly. I think that there is a bug with a custom name... Regards Franck
Found an another bug, my log group I created is with a 3 months retention, and when CloudFront created a new log group in another country it sets it with never expire retention period, that not great that it doesn't take the valur from the origin one... Regards Franck
Relevant content
- asked 5 years ago
- AWS OFFICIALUpdated 8 months ago

please accept the answer if it was helpful