Member since
03-13-2019
2
Posts
0
Kudos Received
0
Solutions
03-21-2019
03:56 PM
Thanks @Matt. Actually Jolt Transformation is the the solution worked for me (reached few days ago, I'm looking for time to write my answer 🙂 ). In my flow I route on an attribute if I want the payload or not and then I apply this Jolt spec: [{
"operation": "shift",
"spec": {
"headers": "headers",
"info": "info",
"payLoad": "payLoad"
}
}, {
"operation": "default",
"spec": {
"_kafka": {
"offset": "${kafka.offset}",
"partition": "${kafka.partition}",
"topic": "${kafka.topic}",
"key": "${kafka.key}"
},
"_nifi": {
"flowfileuuid": "${uuid}"
}
}
} ] Thanks to confirm this is the right way: I'm a newer to NiFi.
... View more
03-13-2019
09:48 PM
Hi at all, I have a JSON in my FlowFile content like this {
"headers": {
"key_1":"value_1",
......
"key_n":"value_n"},
"info": { "key_1":"value_1",
......
"key_n":"value_n"},
"payload": {
"key_1":"value_1",
......
"key_n":"value_n"}
} my aim in the flow is: split the original JSON into three attributes (headers, payload and info) route on a global variable into two subflows merge headers+info+core attributes merge headers+info+payload attributes add core attributes to new JSON content (like uuid, kafka topic, kafka partition, kafka offset) send the new json to splunk with HttpInvoke POST I've tried to implement the bullets 1 with EvaluateJSONPath processor and 2.1, 2.2, 3 bullets with AttributesToJSON processor but I've got this problem: in AttributesToJSON if I use flow-file content as Destination the merge works but it writes headers, info and payload values like unique values instead of other key-value json object. Here an example: {
"headers": "{\"key_1\":\"value_1\",
......
\"key_n\":\"value_n\"}]}}}",
"info": "{\"key_1\":\"value_1\",
......
\"key_n\":\"value_n\"}]}}}",
"payload": "{\"key_1\":\"value_1\",
......
\"key_n\":\"value_n\"}]}}}",
"kafka.partition": "1"
} Any ideas? Thank you!
... View more
Labels:
- Labels:
-
Apache NiFi