Configuring rules in the UpdateAttribute processor

The UpdateAttribute processor updates FlowFile attributes using the Attribute Expression Language and can also remove attributes based on regular expressions. In addition to standard configuration options, the processor allows you to apply conditional logic using rules.

Use Define Rules tab to:

  • Apply complex conditional logic without manual property configuration

  • Manage multiple attribute updates in a structured way

  • Improve readability and maintainability of your flow logic

Rules are a set of conditions and associated actions. Each rule follows an “if–then” structure, so if all conditions are met, then the defined actions are applied. Conditions define when the rule applies, and actions define what changes are made.

  1. Open the UpdateAttribute processor configuration.
  2. Select the Define Rules tab.


  3. Select a FlowFile policy.
    Use Clone

    Applies matching rules to a copy of the FlowFile

    Use Original

    Applies matching rules to the original FlowFile in the specified rule order

  4. Click Add Rule.
  5. Enter a rule name.
  6. Add one or more conditions.
    1. Click Add Condition.
    2. Define the condition using expressions.
  7. Add one or more actions.
    1. Click Add Action.
    2. Specify:
      • Attribute name
      • Valu
  8. Click Apply to save the rule.
Rule: CheckForLargeFiles
Conditions:
  • ${filename:equals('fileOfInterest')}
  • ${fileSize:toNumber():ge(1048576)}
  • ${fileSize:toNumber():lt(1073741824)}
Action:
  • filename = ${filename}.meg

This rule appends .meg to the filename if the:

  • filename is fileOfInterest, and
  • file size is between 1 MB and 1 GB.

Rule: CheckForGiantFiles

Conditions:
  • ${filename:equals('fileOfInterest')}
  • ${fileSize:toNumber():gt(1073741824)}
Action:
  • filename = ${filename}.gig

This rule appends .gig to the filename if the:
  • filename is fileOfInterest, and

  • file size is greater than 1 GB.