# Write Failed Documents to Disk

You cannot start a processor until all of its relationships are connected to other processors, or are auto-terminated. So far, this example has not connected or auto-terminated the "failed" relationship for each of the processors. This section describes how to route "failed" FlowFiles to a processor that will write the documents to disk in IDX, XML, or JSON format.

To write failed documents to disk

1. Add a processor, by dragging the processor icon from the components toolbar to the canvas.

   The Add Processor dialog box opens.

2. In the Source list, click idol.nifi.

   The list of processors is filtered to those that are provided in the NiFi Ingest distribution.

3. Select the WriteDocument processor and click ADD.

   The processor is added to the canvas.

4. Create a connection from each of the processors to the WriteDocument processor. Hover the mouse over a processor (such as KeyViewExtractFiles or KeyViewFilterDocument) until you see the connection icon - - and then drag the icon to the WriteDocument processor. When the Create Connection dialog box opens, look for the For Relationships area and select the failure check box. Then repeat this for your other processors.

5. Right-click the WriteDocument processor and click Configure.

   The Configure Processor dialog box opens.

6. Click the Properties tab.

7. Set the following properties:

   Format | The format in which to write the document (for example IDX or XML).
   File in which to write the document | The path of the file to write the documents to. This could be a path to a shared folder.
   Archive Directory | The path in which files are archived when they exceed the maximum size.
   Max file size in bytes before archiving | The maximum size a file can reach before being archived.

8. Click the Settings tab.
9. In this example, there is nothing to do after writing the failed documents, so in the Automatically Terminate Relationships area, select all of the check boxes (failure, original, and written).

10. Click Apply.

    The pipeline should now look similar to the example described in the introduction.

_FT_HTML5_bannerTitle.htm