serverless-plugin-log-class
v1.0.0
Published
Serverless Framework plugin to set Cloudwatch log class
Readme
serverless-plugin-log-class
Summary
Serverless Framework plugin to specify a custom log class for AWS Lambda functions. By default Serverless Framework uses the Standard log class with no option to change it.
An additional log group will be created for Infrequent Access logs and the original log group will be maintained but unused.
Supported version of Serverless Framework:
- 1.70.0+
- 2.0.0+
- 3.0.0+
- 4.0.0+
Usage
Install the plugin via your favourite npm client:
npm install --save-dev serverless-plugin-log-classEnable the plugin in your serverless.yml:
plugins:
- serverless-plugin-log-classSpecify the desired log class globally or at function level:
custom:
logClassPlugin:
logClass: INFREQUENT_ACCESSor
functions:
myFunction:
handler: handler.myFunction
logClassPlugin:
logClass: INFREQUENT_ACCESSSupported log classes:
- STANDARD (falls back to default serverless behavior)
- INFREQUENT_ACCESS
Notes
The plugin will create a new log group for the specified log class. The original log group will remain but unused.
If you would like to remove the original log group, which would mean losing any existing logs, you can set the following option:
custom:
logClassPlugin:
preserveDefaultLogGroup: false # default: trueAnd even keep the same name (although old logs will still be lost):
custom:
logClassPlugin:
preserveDefaultLogGroup: false # default: true
logGroupNameSuffix: '' # Removes the -ia suffixPlease note: if you decide to remove the suffix, but then want to re-enable the
default log group, you will first need to re-add the suffix and deploy to avoid
a name clash before setting preserveDefaultLogGroup to true.
