嗨,我在流文件中有以下 json:{"destination.port":"0000","network.packets":"1","event.end":"1563361839","source.address":"1.2.2.1","message":"OK","server.address":"ip-1-2-2-3.ec2.internal","event.action":"ACCEPT","event.module":"s3bucket","source.port":"478","network.protocol":"6","cloud.account.id":"123456","event.type":"data","organization.id":"Fusion","destination.address":"1.2.2.2","network.bytes":"60","event.start":"1563361837","event.kind":"2","host.id":"eni-06f72","timestamp":"2019-07-17T11:16:39.792Z"}
以 event.end 和 event.start 作为纪元。
我正在使用 nifi-1.9.2。帮助我将纪元转换为 UTC 中的日期并替换相同的日期。我曾尝试将updateAttribute
处理器与 一起使用/event.start=${event.start:format("yyyy-MM-dd HH:mm:ss.SSS")}
,但不正确。我已经为处理器做了一些阅读,但不能。谢谢
您的问题的根源在于您如何尝试event.start
从 JSON 中提取。表达式语言用于操作 FlowFile 的属性,而不是 FlowFile 的内容。
如果此 JSON 在您的 FlowFile 的内容中,则使用EvaluateJsonPath
, 并将Destination
属性设置为 ,flowfile-attribute
并将名为 的新自定义属性event.start
设置为$['event.start']
。
现在你把它作为属性,把它转移到JoltTransformJSON
with Jolt Transformation DSL
set toModify - Overwrite
和Jolt Specification
set to:
{
"event.start": "${event.start:append('000'):format('yyyy-MM-dd HH:mm:ss.SSS')}"
}
Run Code Online (Sandbox Code Playgroud)
附加的 3 个零是因为 NiFi 中的纪元以毫秒为单位。
归档时间: |
|
查看次数: |
1645 次 |
最近记录: |