最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to use AWS EventBridge Role Event Transformer - Stack Overflow

programmeradmin8浏览0评论

With the source event published on EventBridge as:

{
  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:

For the Input Path I enter:

{"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:

{
  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

With the source event published on EventBridge as:

{
  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:

For the Input Path I enter:

{"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:

{
  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

Share Improve this question edited Feb 1, 2021 at 18:09 oguz ismail 51k16 gold badges60 silver badges79 bronze badges asked Jan 30, 2021 at 0:55 alphanumericalphanumeric 19.4k74 gold badges277 silver badges422 bronze badges 2
  • What event are you actual getting in the destination? – Marcin Commented Feb 3, 2021 at 2:23
  • I am not getting any event in the destination (the destination is AWS CloudWatch Log Group. Once I remove the "Input Transformer" from the Rule, the event is properly reaches the CloudWatch Log. – alphanumeric Commented Feb 3, 2021 at 22:46
Add a ment  | 

1 Answer 1

Reset to default 5 +50

There is a Note on the API_PutTargets page with regard to CloudWatch:

Note If your are using InputTransformer with CloudWatch Logs as a target, the Template must be {"timestamp":,"message":}.

In addition, I would assume that you already did it, but there is a Common Issues with Transforming Input

发布评论

评论列表(0)

  1. 暂无评论