Back to Checks
iac

SAM State machine must have logging enabled

AWS-0119
Service: samSeverity: low
OfficialBuilt-inVerified

Logging enables end-to-end debugging and analysis of all state machine activities.

Run this check with Prowler

Run in Prowler Cloud
Run
prowler iac --checks AWS-0119

Recommendation

Enable logging

Check Code

# METADATA
# title: SAM State machine must have logging enabled
# description: |
#   Logging enables end-to-end debugging and analysis of all state machine activities.
# scope: package
# schemas:
#   - input: schema["cloud"]
# related_resources:
#   - https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-statemachine.html#sam-statemachine-logging
# custom:
#   id: AWS-0119
#   long_id: aws-sam-enable-state-machine-logging
#   aliases:
#     - AVD-AWS-0119
#     - enable-state-machine-logging
#     - aws-sam-enable-state-machine-logging
#   provider: aws
#   service: sam
#   severity: LOW
#   recommended_action: Enable logging
#   input:
#     selector:
#       - type: cloud
#         subtypes:
#           - service: sam
#             provider: aws
#   examples: checks/cloud/aws/sam/enable_state_machine_logging.yaml
package builtin.aws.sam.aws0119

import rego.v1

deny contains res if {
	some state_machine in input.aws.sam.statemachines
	isManaged(state_machine)
	not state_machine.loggingconfiguration.loggingenabled.value
	res := result.new(
		"Logging is not enabled",
		state_machine.loggingconfiguration.loggingenabled,
	)
}