Lakmal Vithanage
Lakmal Vithanage

Reputation: 2777

How to get logs using rest api in apache nifi

I went through several guides and couldn't find a way to get the logs with related information like data size of the flowfile(shown in the image) using rest api (or otherway if rest api is not possible).Eventhough nifi writes these logs to app-logs, Other related details can not find from there. How can I do that?image

EDIT

According to comment from daggett,I have the rest api - http://localhost:8080/nifi-api/flow/bulletin-board, which solved my half of the question. Now I need to know who I can get the flowfile details which caused to the bulletin.

Upvotes: 0

Views: 1133

Answers (1)

Pushkr
Pushkr

Reputation: 3619

There are few controller services provided by nifi which gives in-depth information about status of nifi as well as information about flowfiles. One of those services is SiteToSiteProvenanceReportingTask which you can use to derive the information about the failed file.

These controller services basically send information about flowfile as json data which can be queried or processed as flowfile in nifi.

Here is json data that above controller service returns -

{
  "type" : "record",
  "name" : "provenance",
  "namespace" : "provenance",
  "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": ["null", "string"] },
    { "name": "componentId", "type": ["null", "string"] },
    { "name": "componentType", "type": ["null", "string"] },
    { "name": "componentName", "type": ["null", "string"] },
    { "name": "processGroupId", "type": ["null", "string"] },
    { "name": "processGroupName", "type": ["null", "string"] },
    { "name": "entityId", "type": ["null", "string"] },
    { "name": "entityType", "type": ["null", "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": ["null", "string"] },
    { "name": "contentURI", "type": ["null", "string"] },
    { "name": "previousContentURI", "type": ["null", "string"] },
    { "name": "parentIds", "type": { "type": "array", "items": "string" } },
    { "name": "childIds", "type": { "type": "array", "items": "string" } },
    { "name": "platform", "type": "string" },
    { "name": "application", "type": "string" },
    { "name": "remoteIdentifier", "type": ["null", "string"] },
    { "name": "alternateIdentifier", "type": ["null", "string"] },
    { "name": "transitUri", "type": ["null", "string"] }
  ]
}

entityId ,entitySize is what you may be looking for.

Upvotes: 1

Related Questions