Amazon web services 将cloudwatch请求id替换为自定义唯一id
我想向我的cloudwatch活动发送一个唯一的id。Amazon web services 将cloudwatch请求id替换为自定义唯一id,amazon-web-services,amazon-s3,amazon-ec2,aws-lambda,serverless,Amazon Web Services,Amazon S3,Amazon Ec2,Aws Lambda,Serverless,我想向我的cloudwatch活动发送一个唯一的id。 下图显示了请求id。必须更改此唯一id 下面是我的lambda函数的serverless.yml代码。 我试图添加一个输入(输入变压器),但效果不大。 我能在这里做什么 functions: stream-function: handler: src/stream-handler/stream.handler memorySize: 1024 #in MB, also control CPU throughput
下图显示了请求id。必须更改此唯一id 下面是我的lambda函数的serverless.yml代码。
我试图添加一个输入(输入变压器),但效果不大。
我能在这里做什么
functions:
stream-function:
handler: src/stream-handler/stream.handler
memorySize: 1024 #in MB, also control CPU throughput
timeout: 31 #in seconds, match with downstream to avoid concurrent request
events:
- stream:
type: kinesis
arn:
Fn::GetAtt: [HagoStream, Arn]
batchSize: 1
parallelizationFactor: 2
Id: "my cloud watch rule name"
InputTransformer: {
InputTemplate: '{"uniqueId": "96c80428-14fe-c8d0-f6e3-639384992391"}',
InputPathsMap: {
id: '$.uniqueId'
}
}
maximumRetryAttempts: 2
destinations:
onFailure:
arn:
Fn::GetAtt: [HagoFailedQueue, Arn]
type: sqs
environment:
DLQ_URL:
Ref: HagoDlqQueue
这是为lambda函数调用指定的AWS。你不能改变它
RequestId–调用的唯一请求ID
相反,在函数代码中,您可以生成一些额外的ID,与您的其他数据一起输出到CloudWatch日志中。注意。好的,我想给我的日志发送一个额外的唯一ID。最好的方法是什么???@grooot它的用例说明。在python中,只需执行
print(f“MyRequestId:{id,您根据应用程序需求生成的id}”)
@grooot它进行得如何?你成功生成身份证了吗?是的,谢谢你。