The Site-to-Site Provenance Reporting Task allows the user to publish all of the Provenance Events from a NiFi instance back to the same NiFi instance or another NiFi instance. This provides a great deal of power because it allows the user to make use of all of the different Processors that are available in NiFi in order to processor or distribute that data. When possible, it is advisable to send the Provenance data to a different NiFi instance than the one that this Reporting Task is running on, because when the data is received over Site-to-Site and processed, that in and of itself will generate Provenance events. As a result, there is a cycle that is created. However, the data is sent in batches (1,000 by default). This means that for each batch of Provenance events that are sent back to NiFi, the receiving NiFi will have to generate only a single event per component.

When published to a NiFi instance, the Provenance data is sent as a JSON array. Quite often, it can be useful to work with this data using a schema. As such, the schema for this Provenance data can be defined as follows:


{
  "namespace": "nifi",
  "name": "provenanceEvent",
  "type": "record",
  "fields": [
    { "name": "eventId", "type": "string" },
    { "name": "eventOrdinal", "type": "long" },
    { "name": "eventType", "type": "string" },
    { "name": "timestampMillis", "type": "long" },
    { "name": "durationMillis", "type": "long" },
    { "name": "lineageStart", "type": { "type": "long", "logicalType": "timestamp-millis" } },
    { "name": "details", "type": "string" },
    { "name": "componentId", "type": "string" },
    { "name": "componentType", "type": "string" },
    { "name": "entityId", "type": "string" },
    { "name": "entityType", "type": "string" },
    { "name": "entitySize", "type": ["null", "long"] },
    { "name": "previousEntitySize", "type": ["null", "long"] },
    { "name": "updatedAttributes", "type": { "type": "map", "values": "string" } },
    { "name": "previousAttributes", "type": { "type": "map", "values": "string" } },
    { "name": "actorHostname", "type": "string" },
    { "name": "contentURI", "type": "string" },
    { "name": "previousContentURI", "type": "string" },
    { "name": "parentIds", "type": { "type": "array", "items": "string" } },
    { "name": "childIds", "type": { "type": "array", "items": "string" } },
    { "name": "platform", "type": "string" },
    { "name": "application", "type": "string" },
    { "name": "transitUri", "type": ["null", "string"] }
  ]
}