ExecuteStreamCommand

Description:

The ExecuteStreamCommand processor provides a flexible way to integrate external commands and scripts into NiFi data flows. ExecuteStreamCommand can pass the incoming FlowFile's content to the command that it executes similarly how piping works.

Additional Details...

Tags:

command execution, command, stream, execute

Properties:

In the list below, the names of required properties appear in bold. Any other properties (not in bold) are considered optional. The table also indicates any default values, and whether a property supports the NiFi Expression Language.

Display NameAPI NameDefault ValueAllowable ValuesDescription
Working DirectoryWorking DirectoryThe directory to use as the current working directory when executing the command
Supports Expression Language: true (will be evaluated using flow file attributes and variable registry)
Command PathCommand PathSpecifies the command to be executed; if just the name of an executable is provided, it must be in the user's environment PATH.
Supports Expression Language: true (will be evaluated using flow file attributes and variable registry)
Command Arguments StrategyargumentsStrategyCommand Arguments Property
  • Command Arguments Property Arguments to be supplied to the executable are taken from the Command Arguments property
  • Dynamic Property Arguments Arguments to be supplied to the executable are taken from dynamic properties with pattern of 'command.argument.<commandIndex>'
Strategy for configuring arguments to be supplied to the command.
Command ArgumentsCommand ArgumentsThe arguments to supply to the executable delimited by the ';' character.
Supports Expression Language: true (will be evaluated using flow file attributes and variable registry)

This Property is only considered if the [Command Arguments Strategy] Property has a value of "Command Arguments Property".
Argument DelimiterArgument Delimiter;Delimiter to use to separate arguments for a command [default: ;]. Must be a single character

This Property is only considered if the [Command Arguments Strategy] Property has a value of "Command Arguments Property".
Ignore STDINIgnore STDINfalse
  • true
  • false
If true, the contents of the incoming flowfile will not be passed to the executing command
Output Destination AttributeOutput Destination AttributeIf set, the output of the stream command will be put into an attribute of the original FlowFile instead of a separate FlowFile. There will no longer be a relationship for 'output stream' or 'nonzero status'. The value of this property will be the key for the output attribute.
Max Attribute LengthMax Attribute Length256If routing the output of the stream command to an attribute, the number of characters put to the attribute value will be at most this amount. This is important because attributes are held in memory and large attributes will quickly cause out of memory issues. If the output goes longer than this value, it will truncated to fit. Consider making this smaller if able.
Output MIME TypeOutput MIME TypeSpecifies the value to set for the "mime.type" attribute. This property is ignored if 'Output Destination Attribute' is set.

Dynamic Properties:

Supports Sensitive Dynamic Properties: Yes

Dynamic Properties allow the user to specify both the name and value of a property.

NameValueDescription
An environment variable nameAn environment variable valueThese environment variables are passed to the process spawned by this Processor
Supports Expression Language: false
command.argument.<commandIndex>Argument to be supplied to the commandThese arguments are supplied to the process spawned by this Processor when using the Command Arguments Strategy : Dynamic Property Arguments. <commandIndex> is a number and it will determine the order.
Supports Expression Language: false

Relationships:

NameDescription
output streamThe destination path for the flow file created from the command's output, if the returned status code is zero.
nonzero statusThe destination path for the flow file created from the command's output, if the returned status code is non-zero. All flow files routed to this relationship will be penalized.
originalThe original FlowFile will be routed. It will have new attributes detailing the result of the script execution.

Reads Attributes:

None specified.

Writes Attributes:

NameDescription
execution.commandThe name of the command executed
execution.command.argsThe semi-colon delimited list of arguments. Sensitive properties will be masked
execution.statusThe exit status code returned from executing the command
execution.errorAny error messages returned from executing the command
mime.typeSets the MIME type of the output if the 'Output MIME Type' property is set and 'Output Destination Attribute' is not set

State management:

This component does not store state.

Restricted:

Required PermissionExplanation
execute codeProvides operator the ability to execute arbitrary code assuming all permissions that NiFi has.

Input requirement:

This component requires an incoming relationship.

System Resource Considerations:

None specified.