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
preguntada hace 4 años1295 visualizaciones
1 Respuesta
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
respondido hace 4 años

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas