使用 Morphlines 中的 ReadJson 命令将整个 JsonObject 保存到变量?
Save entire JsonObject to a variable using the ReadJson command in Morphlines?
我查看了 Morphlines 的文档(可在 http://cloudera.github.io/cdk/docs/current/cdk-morphlines/morphlinesReferenceGuide.html 获得),从外观上看,没有办法将整个 Json 对象存储到 Morphlines 中的变量,使用ReadJson{} 命令。我知道这可以使用 ReadLine{} 命令和此代码:
{
addValues {
value_raw : "@{message}"
}
}
我想知道是否有人知道使用 ReadJson{} 执行类似命令以将整个 event/object/message 存储在变量中的方法,或者这是否只能使用 ReadLine{} ?
我想知道是否可以在同一 Morphlines 配置文件中独立使用 ReadLine{} 和 ReadJson{}?
是的,这是可能的。您可以使用:
addValues {
value_raw : "@{_attachment_body}"
}
将整个event/object/message保存到一个变量中。如果您在 Morphlines 中使用 ReadJson 命令,所有事件都应驻留在名为“_attachment_body”的 Json 对象中,因此您可以分配整个事件的值到一个变量。
我查看了 Morphlines 的文档(可在 http://cloudera.github.io/cdk/docs/current/cdk-morphlines/morphlinesReferenceGuide.html 获得),从外观上看,没有办法将整个 Json 对象存储到 Morphlines 中的变量,使用ReadJson{} 命令。我知道这可以使用 ReadLine{} 命令和此代码:
{
addValues {
value_raw : "@{message}"
}
}
我想知道是否有人知道使用 ReadJson{} 执行类似命令以将整个 event/object/message 存储在变量中的方法,或者这是否只能使用 ReadLine{} ?
我想知道是否可以在同一 Morphlines 配置文件中独立使用 ReadLine{} 和 ReadJson{}?
是的,这是可能的。您可以使用:
addValues {
value_raw : "@{_attachment_body}"
}
将整个event/object/message保存到一个变量中。如果您在 Morphlines 中使用 ReadJson 命令,所有事件都应驻留在名为“_attachment_body”的 Json 对象中,因此您可以分配整个事件的值到一个变量。