Apache nifi 从Nifi中的AttributesToJSON生成json文件时出现问题?

Apache nifi 从Nifi中的AttributesToJSON生成json文件时出现问题?,apache-nifi,Apache Nifi,但是这些文件还有其他属性,如absolute.path、filename、uuid,这些属性在上面的json文件中丢失。 我的要求是,获取absolute.path、filename和uuid并连接absolute.path+/+filename,将其分配给自定义属性,比如filepath:absolute.path+/+filename,并将uuid添加到json对象中。 所以我的json文件应该是 the out for the above case in my scenario is …

但是这些文件还有其他属性,如absolute.path、filename、uuid,这些属性在上面的json文件中丢失。 我的要求是,获取absolute.path、filename和uuid并连接absolute.path+/+filename,将其分配给自定义属性,比如filepath:absolute.path+/+filename,并将uuid添加到json对象中。
所以我的json文件应该是

the out for the above case in my scenario is …
{"fragment.size":"125"
file.group:"root",
file.lastModifiedTime:"2020-12-22T15:09:13+0000",
fragment.identifier:"ee5770ea-8406-400a-a2fd-2362bd706fe0",
fragment.index:"1",
file.creationTime:"2020-12-22T15:09:13+0000",
file.lastAccessTime:"2020-12-22T17:34:22+0000",
segment.original.filename:"Sample-Spreadsheet-10000-rows.csv",
file.owner:"root",
fragment.count:"2",
file.permissions:"rw-r--r--",
text.line.count:"1"}
}

如果查看文档,您可以看到可以在
属性列表
属性中指定属性。所以你可以试着列出你想要的属性

或者。听起来每个文件都有一个流文件?您可以使用来插入字段。您可以使用
文字值
作为
替换值策略
,该策略将允许您使用插入值-例如,您可以添加一个名为
filename
的属性,该属性的值为
${filename}
filename
属性的值插入JSON中名为
filename
的字段


要合并这两个字段,可以执行以下操作:
${allAttributes(“absolute.path”,“filename”):join('/')}
或使用
append()

将核心属性包含到json中,并使用
包含核心属性
参数。可能使用
属性正则表达式指定要包含在结果中的属性…感谢您的回复,我通过在updateRecord中使用自定义属性解决了这个问题,然后我从AttributesToJSON中提取了这些自定义属性,这解决了我的问题。
the out for the above case in my scenario is …
{"fragment.size":"125"
file.group:"root",
file.lastModifiedTime:"2020-12-22T15:09:13+0000",
fragment.identifier:"ee5770ea-8406-400a-a2fd-2362bd706fe0",
fragment.index:"1",
file.creationTime:"2020-12-22T15:09:13+0000",
file.lastAccessTime:"2020-12-22T17:34:22+0000",
segment.original.filename:"Sample-Spreadsheet-10000-rows.csv",
file.owner:"root",
fragment.count:"2",
file.permissions:"rw-r--r--",
text.line.count:"1"}
}
{ uuid:"file uuid value", filepath:"absolute.path+/+filename" }

 

any inputs to get above  form of json file