Configuring advanced usage of the UpdateAttribute processor

The UpdateAttribute processor may be used to make conditional changes, based on user defined rules.

Rules are a set of Conditions and associated Actions. Each rule basically says, "If these conditions are met, then do this action." One or more conditions may be used in a given rule, and they all must be met in order for the designated action(s) to be taken.

In this topic we use two rules as an example to demonstrate how adding rules work: CheckForLargeFiles and CheckForGiantFiles.

The CheckForLargeFiles rule has the following conditions:

  • ${filename:equals('fileOfInterest')}
  • ${fileSize:toNumber():ge(1048576)}
  • ${fileSize:toNumber():lt(1073741824)}

The associated action for the filename attribute:

  • ${filename}.meg

Taken together, this rule says:

  • If the value of the filename attribute is fileOfInterest, and
  • If the fileSize is greater than or equal to (ge) one megabyte (1,048,576 bytes), and
  • If the fileSize is less than (lt) one gigabyte (1,073,741,824 bytes)
  • Then change the value of the filename attribute by appending ".meg" to the filename.

Continuing with this example, we can add another rule to check for files that are larger than one gigabyte. When we add this second rule, we can use the previous rule as a template, so to speak, by selecting the Expand > Duplicate option for the CheckForLargeFiles rule.

In this example, the CheckForGiantFiles rule has these conditions:

  • ${filename:equals('fileOfInterest')}
  • ${fileSize:toNumber():gt(1073741824)}

Then it has this action for the filename attribute:

  • ${filename}.gig

Taken together, this rule says:

  • If the value of the filename attribute is fileOfInterest, and
  • If the fileSize is greater than (gt) one gigabyte (1,073,741,824 bytes)
  • Then change the value of the filename attribute by appending ".gig" to the filename.
  1. To add rules to the UpdateAttribute processor and to define behavior when multiple rules match, go to Configuration Pane > Define Rules.


  2. Select a Flow File Policy:
    Use Clone
    Matching rules are executed with a copy of the original flow file. This is the default behavior.
    Use Original
    Matching rules are executed with the original flow file, in the order that you specify under Rule Order List.

Add a Rule

  1. You can add rules by clicking Add Rule.
  2. Specify a Rule Name.
    Specify CheckForLargeFiles
  3. Add Conditions by clicking Add Condition.
    In the Add Condition modal window you can specify a condition using regular expressions.
    Add the ${filename:equals('fileOfInterest')}
    Click Add Condition in the modal window to save your changes.
  4. To add Actions, click Add Action.
    In the Add Action modal window specify an Attribute name and a Value.
    For example, specify filename as Attribute and ${filename}.meg as Value.
    Click Add Action to save your changes.
  5. Once you are done with creating or updating a Rule, click Apply to save your changes.

Reorder Rules

  1. To reorder Rules, grab one by the Drag Handle and drag it to the required position.
  2. Click Apply.