How divide Log Group by each Lambda function alias?

0

Hello, guys.

Thank you for your help in advance.

I have a question, how divide Log Group by each Lambda function alias?
For example, there is the following Lambda function and aliases.

  • Lambda function
    testFunctionKoki

  • Lambda function aliases
    dev
    test
    pro

I would like to create Log Group by each alias using boto3 or AWS CLI when creating Lambda function alias, and to relate each Log Group and each alias.
Such as this.

  • When creating dev alias, creating Log Group that is '/aws/lambda/testFunctionKoki:dev'.
  • When testFunctionKoki that alias is dev has executed, outputting any logs to '/aws/lambda/testFunctionKoki:dev'.

How can I do this?
I am looking for any answers.
Thank you.

Edited by: koki-n on Jun 14, 2020 6:46 PM

koki-n
demandé il y a 4 ans1295 vues
1 réponse
0

Hello,

Lambda does not provide a way to specify a custom log group target. A log group is automatically created on the first invocation of a Lambda and the log group name will contain the name of the Lambda function.

When log streams are created however, the function version is prefixed onto the name of the log stream. You can use a log stream filter to view log streams for a specific version.

If you want to know which alias invoked a particular version of a Lambda, the alias ARN is included in the Lambda context object as: context.invoked_function_arn You can use the print method to write the ARN into the log event.

Best,
Kevin

AWS
répondu il y a 4 ans

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions