-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(aws-lambda): Allow writing Lambda logs to existing Log Group #8672
Comments
Unfortunately, the Lambda service reports logs to a specific log group, named after the function - https://docs.aws.amazon.com/lambda/latest/dg/monitoring-cloudwatchlogs.html. As far as I know, there is no way to control which log group this goes to.
Not technically. In the default case, the Lambda service creates this log group. When you specify the Let me know if there's something that I missed here. |
nija-at, could you explain why this limitation exists. I have a state machine with multiple lambda functions and I want to have logs in one place rather going and querying them in corresponding lambda log groups. |
@sith this is a limitation of the AWS Lambda service itself, not something that can be solved with CloudFormation or AWS CDK (which all are built on top of AWS services like Lambda). See this for further information. If you want to achieve true aggregation of logs for your whole State Machine that is composed of Lambdas that write to multiple |
I'm looking at cdk-lib/lambda/Function and I see a
I'm wondering if maybe this prop became available after this discussion took place? Unless I'm misunderstanding its functionality. If I'm not mistaken, one can just: import * as logs from '@aws-cdk/aws-logs';
import * as lambda from '@aws-cdk/aws-lambda';
const aggregatedLogGroup = new logs.LogGroup(this, 'AggregatedLogGroup', {
logGroupName: '/aws/lambda/aggregated',
});
const myFunction = new lambda.Function(this, 'MyFunction', {
...
logGroup: aggregatedLogGroup,
}); |
@lefnire you are probably mistaking the |
@Dzhuneyt you're absolutely correct. Thanks for pointing that out! |
Just an update: I see a change in CDK API to set a custom log group from v2.110. I am trying to use this and will update after using |
Our project relies heavily on many Lambdas (that back AppSync as Data Sources). We'd love to be able to have a centralized "log" of all these lambdas. Currently, such logs are scattered across multiple Log groups (one per lambda). In other words, the Lambda construct currently creates its own log group and has no way of referring to an existing Log group where Lambda logs should be written.
Proposed Solution
This is a 🚀 Feature Request
The text was updated successfully, but these errors were encountered: