简体   繁体   English

如何使用 AWS EventBridge 角色事件转换器

[英]How to use AWS EventBridge Role Event Transformer

With the source event published on EventBridge as:在 EventBridge 上发布的源事件为:

{
  version: '0',
  id: '1234-5678-9102-3456-7890',
  'detail-type': 'My-Detail-Type',
  source: 'My-Source',
  account: '328927794502',
  time: '2021-01-29T23:52:48Z',
  region: 'us-east-1',
  resources: [],
  detail: { year: '2020' }
}

I go ahead and create the EventBridge Rule with the Target Transformer:我提前 go 并使用目标转换器创建 EventBridge 规则:

For the Input Path I enter:对于Input Path ,我输入:

{"data_joined":"$.detail.year"}

And for the Input Template I enter:对于输入模板,我输入:

{"Data-Joined" : <data_joined>}

在此处输入图像描述

Now when this event is transformed and sent to the destination (it could be Lambda function, CloudWatch Event log group and etc) I expect the transformed event to be:现在,当此事件被转换并发送到目的地时(可能是 Lambda function、CloudWatch 事件日志组等),我预计转换后的事件是:

{
  version: '0',
  id: '1234-5678-9102-3456-7890',
  'detail-type': 'My-Detail-Type',
  source: 'My-Source',
  account: '328927794502',
  time: '2021-01-29T23:52:48Z',
  region: 'us-east-1',
  resources: [],
  detail: { Data-Joined: '2020' }
}

Unfortunately, this doesn't work as I am not able to find this transformed event anywhere.不幸的是,这不起作用,因为我无法在任何地方找到这个转换后的事件。 Is there anything I should be doing differently有什么我应该做的不同的吗

There is a Note on the API_PutTargets page with regard to CloudWatch: API_PutTargets页面上有一条关于 CloudWatch 的注释:

Note If your are using InputTransformer with CloudWatch Logs as a target, the Template must be {"timestamp":,"message":}.注意 如果您使用 InputTransformer 和 CloudWatch Logs 作为目标,则模板必须是 {"timestamp":,"message":}。

In addition, I would assume that you already did it, but there is a Common Issues with Transforming Input另外,我假设您已经这样做了,但是转换输入存在一个常见问题

Did it work?它奏效了吗? I am facing exactly same problem & not yet resolved after checking the above answer.检查上述答案后,我面临完全相同的问题并且尚未解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM