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
gefragt vor 4 Jahren1295 Aufrufe
1 Antwort
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
beantwortet vor 4 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen