Search code examples
aws-lambdaaws-step-functionsaws-cloudwatch-log-insights

Get corresponding lambda log stream for statemachine execution


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.


Solution

  • 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"