Skip to content
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

feat(AWS Lambda): Support loggingConfig #12315

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

ryy
Copy link

@ryy ryy commented Dec 28, 2023

Closes: #12264

}

if (functionObject.loggingConfig.logGroup) {
loggingConfig.LogGroup = functionObject.loggingConfig.logGroup;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By default, Serverless also provisions the Log Group itself as part of it's cloudformation stack. At that stage, the custom log group name also needs to be checked.

functionResource.Properties.LoggingConfig = loggingConfig;
}
}

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this could be more compact as:

if (functionObject.loggingConfig) {
  const loggingConfig = {};

  ({
    ApplicationLogLevel: loggingConfig.applicationLogLevel,
    LogFormat: loggingConfig.logFormat,
    LogGroup: loggingConfig.logGroup,
    SystemLogLevel: loggingConfig.systemLogLevel,
  } = functionObject.loggingConfig);

  functionResource.Properties.LoggingConfig = Object.keys(loggingConfig).length ? loggingConfig : undefined;
}

@tusharf5
Copy link

tusharf5 commented Mar 4, 2024

would this also allow to set this config at a global level so it's applied to all lambdas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable LoggingConfig configuration on Lambda Functions
3 participants