Get corresponding lambda log stream for statemachine execution

Viewed 280

statemachine logs for a specific execution can be easily queried in cloudwatch via the execution_arn field in the log events.

However how can i find out which logs/logstreams of the LAMBDA functions correspond to which statemachine execution? I haven't found any connection so far. Ideally i would have expected to find an execution_arn field also in the lambda logs when called from stepfunctions.

1 Answers

There is no connection. You can, however, manually associate your Lambda logs with a State Machine execution by including the execution ARN in your input payload and logging it in Lambda. The execution ARN is available on the State Machine context object:

"Execution.$": "$$.Execution.Id"
Related