docs: Add logging configuration docs (#12390)

This commit is contained in:
Max Marze 2024-03-16 21:58:45 -04:00 committed by GitHub
parent acb5701f4f
commit 97bdcf5f05
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 21 additions and 1 deletions

View File

@ -522,6 +522,16 @@ Configure logs for the deployed resources:
```yml
provider:
logs:
# Optional Configuration of Lambda Logging Configuration
lambda:
# The Log Format to be used for all lambda functions (default: Text)
logFormat: JSON
# The Application Log Level to be used, This can only be set if `logFormat` is set to `JSON`
applicationLogLevel: ERROR
# The System Log Level to be used, This can only be set if `logFormat` is set to `JSON`
systemLogLevel: INFO
# The LogGroup that will be used by default. If this is set the Framework will not create LogGroups for any functions
LogGroup: /aws/lambda/global-log-group
# Enable HTTP API logs
# This can either be set to `httpApi: true` to use defaults, or configured via subproperties
# Can only be configured if the API is created by Serverless Framework
@ -656,6 +666,16 @@ functions:
disableLogs: false
# Duration for CloudWatch log retention (default: forever). Overrides provider setting.
logRetentionInDays: 14
# Optional Configuration of Lambda Logging Configuration, if this is also set at the provider level, then a given functions configuration will take priority.
logs:
# The Log Format to be used for all lambda functions (default: Text)
logFormat: JSON
# The Application Log Level to be used, This can only be set if `logFormat` is set to `JSON`
applicationLogLevel: ERROR
# The System Log Level to be used, This can only be set if `logFormat` is set to `JSON`
systemLogLevel: INFO
# The LogGroup that will be used by default. If this is set the Framework will not create LogGroups for any functions
LogGroup: /aws/lambda/global-log-group
tags: # Function specific tags
foo: bar
# VPC settings for this function

View File

@ -724,7 +724,7 @@ class AwsProvider {
type: 'string',
enum: ['DEBUG', 'ERROR', 'FATAL', 'INFO', 'TRACE', 'WARN']
},
logFormat: { type: 'string', enum: ['JSON', 'TRACE']},
logFormat: { type: 'string', enum: ['JSON', 'Text']},
logGroup: { type: 'string', pattern: '[\\.\\-_/#A-Za-z0-9]+', minLength: 1, maxLength: 512},
systemLogLevel: { type: 'string', enum: ['DEBUG', 'INFO', 'WARN'] }
},