amazon-web-services - 将 cloudwatch 请求 ID 替换为自定义唯一 ID
问题描述
我想向我的 cloudwatch 事件发送一个唯一 ID。
下图显示了请求 ID。必须更改此唯一 ID。
下面是我的 lambda 函数的 serverless.yml 代码。
我试图添加一个输入(InputTransformers),但它没有做太多。
我能在这里做什么???
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
解决方案
这是 AWS为您的 lambda 函数调用分配的唯一 ID 。你不能改变它。
RequestId – 调用的唯一请求 ID。
相反,在您的函数代码中,您可以生成一些额外的 ID,与您的其他数据一起在 CloudWatch Logs 中输出。
推荐阅读
- javascript - 如何为域中的两个文件夹显示不同的本地存储
- javascript - 对于我的案例,是否有一个很好的替代方法,可以对 js 进行积极的后视?
- reactjs - 反应js | 反应路由器dom | 多个文件 ..module.scss | 风格问题
- rust - 为什么我可以在一种情况下指定后期绑定的生命周期参数,但不能在另一种情况下指定?
- javascript - 如何在 React Native 中使用 KeyboardAvoidingView?
- xamarin - 在我的 Xamarin 表单应用程序中使用 C# 标记时,如何链接 CarouselView 和指示器?
- nginx - 具有内部(clusterip)和外部(nodeport)配置的 kubernetes 多端口
- java - 在 arrayList 中打印布尔响应的反面
- .net - 优化提取 id 然后基于该 id 的消息的查询
- next.js - Next JS 获取一次数据以显示在所有页面上