如何将自定义属性添加到 AttributesToJSON?

How to add custom attributes to AttributesToJSON?

我有一个场景,文件列表来自以前的处理器,对于每个文件,我必须创建 json 具有流文件属性的文件。在 AttributesToJSON 处理器配置中,有提取管道属性的选项,可以创建 json files/object,如果我们将 Include Core Attributes 设置为 true,它将读取一些文件属性并形成 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"}
}



 But the files has other properties, like absolute.path, filename, uuid  are missing in the above json file.
    My requirement is, get the absolute.path, filename and uuid and concatenate absolute.path+/+filename, assign this to custom attribute say filepath:absolute.path+/+filename and also add uuid to json object.  

所以我的 json 文件应该像

{ uuid:"文件uuid值", 文件路径:“absolute.path+/+文件名” } 获得上述 json 文件的任何输入。

使用 UpdateAttribute 处理器在传递给 AttributestoJSON 之前删除不需要的属性,或者您也可以在 attributesToJSON 处理器中指定您需要的确切属性。