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
질문됨 4년 전1317회 조회
1개 답변
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
답변함 4년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠