简体   繁体   English

如何将验证错误消息从 Nifi 的 ValidateResult 处理器获取到属性中

[英]How to get Validation error message into a Attribute from ValidateResult Processor of Nifi

I am trying to validate a json using ValidateRecord Processor via Avroschemaregistry.我正在尝试通过 Avroschemaregistry 使用 ValidateRecord Processor 验证 json。 I need to store validation error message into a sql table, so i tried to capture the error message in attribute but i am unable to capture the error message in attribute, any idea how to do it我需要将验证错误消息存储到 sql 表中,所以我尝试在属性中捕获错误消息,但我无法在属性中捕获错误消息,不知道怎么做

After your ValidateRecord Processor, you can choose to route flow files which are 'invalid' to a separte log and route them to your sql table, you can do the same if they 'fail'.在您的 ValidateRecord 处理器之后,您可以选择将“无效”的流文件路由到单独的日志并将它们路由到您的 sql 表,如果它们“失败”,您可以执行相同的操作。 I am assuming from the 'error message' you mean the 'bullentin' which would occur when the Processor can neither validate or invalidate the flow file based on your schema.我从“错误消息”中假设您的意思是当处理器无法根据您的架构验证或使流文件无效时会发生的“公告”。

A potential solution to this is to use the SiteToSiteBulletinReportingTask一个潜在的解决方案是使用 SiteToSiteBulletinReportingTask

Screenshot of SiteToSiteBulletinReportingTask SiteToSiteBulletinReportingTask 的屏幕截图

You can build a dataflow to receive these bulletin events, manipulate them as you want and store them in a location of your choice for your auditing needs.您可以构建一个数据流来接收这些公告事件,根据需要对其进行操作,并将它们存储在您选择的位置以满足您的审计需要。

From the sounds of it, the SiteToSiteBulletinReportingTask should be able to achieve what you want.从它的声音来看,SiteToSiteBulletinReportingTask 应该能够实现您想要的。 To implement this, add a iteToSiteBulletinReportingTask to the 'Reporting Tasks' in the NiFi Settings: Reporting Tasks in NiFi Settings要实现这一点,请将 iteToSiteBulletinReportingTask 添加到 NiFi 设置中的“报告任务”:NiFi 设置中的报告任务

You can name your input port and have it flow towards your SQL store and you should have what you're after.您可以命名您的输入端口并让它流向您的 SQL 存储,您应该拥有您想要的东西。

You need to allow NiFi nodes to receive data via site-to-site on the input port and you also need to grant the correct permissions on the root process group so the nodes are able to see the component, view and modify the data.您需要允许 NiFi 节点通过输入端口上的站点到站点接收数据,并且您还需要授予对根进程组的正确权限,以便节点能够查看组件、查看和修改数据。

Side note: I would usually log everything, and have all failures and invalid route to log files, which I put to store, eg HBase/SQL.旁注:我通常会记录所有内容,并将所有失败和无效的路由路由到我存储的日志文件,例如 HBase/SQL。 One suggestion I've seen is configure the logging subsystem to additionally send specific error categories to your destination of choice (eg active notification vs passive parsing of logs).我看到的一个建议是配置日志子系统,将特定的错误类别额外发送到您选择的目的地(例如主动通知与被动解析日志)。 NiFi is leveraging a very flexible logback system (an evolution of log4j). NiFi 正在利用一个非常灵活的 logback 系统(log4j 的演变)。 The best part - changes to the $NIFI_HOME/conf/logback.xml configuration file do not require an instance restart, will be picked up within 30 seconds or less.最好的部分 - 对 $NIFI_HOME/conf/logback.xml 配置文件的更改不需要实例重新启动,将在 30 秒或更短的时间内完成。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM