使用无服务器运行 lambda 时未创建日志流

问题描述

我使用 cloudformation 为我的 lambda 创建了一个日志组,并且当我运行我的 cloudformation 脚本时,lambda 函数包括 cloudwatch 日志触发器。当我调用 lambda 时,我使用 cloudformation 创建的日志组中没有任何日志流,但似乎 cloudformation 会自动为 lambda 创建一个日志组,无论我是否使用 cloudformation 创建一个并将其包含在函数中.

请问有什么建议吗?

'''

KeyPackId         : 3
KeyPackType       : 2
ProductVersion    : Windows Server 2016
TypeAndModel      : RDS Per User CAL
AvailableLicenses : 48
IssuedLicenses    : 1202
ExpirationDate    : 20380101000000.000000-000

KeyPackId         : 5
KeyPackType       : 7
ProductVersion    : Windows Server 2012
TypeAndModel      : RDS Per User CAL
AvailableLicenses : 0
IssuedLicenses    : 1
ExpirationDate    : 20380119031407.000000-000

KeyPackId         : 7
KeyPackType       : 7
ProductVersion    : Windows Server 2016
TypeAndModel      : RDS Per User CAL
AvailableLicenses : 0
IssuedLicenses    : 49
ExpirationDate    : 20380119031407.000000-000"

解决方法

您不能将任意日志组分配给 Lambda 函数。有一个开放的Feature Request

如果您只是想更改日志保留策略,那么您可以使用 this technique 来实现,但它仍然不允许您控制日志组名称。