RenameRecordField

Description:

Renames one or more fields in each Record of a FlowFile. This Processor requires that at least one user-defined Property be added. The name of the Property should indicate a RecordPath that determines the field that should be updated. The value of the Property is the new name to assign to the Record Field that matches the RecordPath. The property value may use Expression Language to reference FlowFile attributes as well as the variables `field.name`, `field.value`, `field.type`, and `record.index`

Tags:

update, record, rename, field, generic, schema, json, csv, avro, log, logs

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.

Display NameAPI NameDefault ValueAllowable ValuesDescription
Record ReaderRecord ReaderController Service API:
RecordReaderFactory
Implementations: CSVReader
JsonPathReader
AvroReader
CEFReader
Syslog5424Reader
JsonTreeReader
WindowsEventLogReader
XMLReader
SyslogReader
JASN1Reader
ReaderLookup
ParquetReader
GrokReader
ScriptedReader
YamlTreeReader
ExcelReader
Specifies the Controller Service to use for reading incoming data
Record WriterRecord WriterController Service API:
RecordSetWriterFactory
Implementations: XMLRecordSetWriter
FreeFormTextRecordSetWriter
AvroRecordSetWriter
ScriptedRecordSetWriter
JsonRecordSetWriter
ParquetRecordSetWriter
RecordSetWriterLookup
CSVRecordSetWriter
Specifies the Controller Service to use for writing out the records

Dynamic Properties:

Supports Sensitive Dynamic Properties: No

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

NameValueDescription
A RecordPath that identifies which field(s) to updateThe new name to assign to the Record fieldAllows users to specify a new name for each field that matches the RecordPath.
Supports Expression Language: true (will be evaluated using flow file attributes and Environment variables)

Relationships:

NameDescription
failureIf a FlowFile cannot be transformed from the configured input format to the configured output format, the unchanged FlowFile will be routed to this relationship
successFlowFiles that are successfully transformed will be routed to this relationship

Reads Attributes:

None specified.

Writes Attributes:

NameDescription
record.indexThis attribute provides the current row index and is only available inside the literal value expression.

State management:

This component does not store state.

Restricted:

This component is not restricted.

Input requirement:

This component requires an incoming relationship.

Example Use Cases:

Use Case:

Rename a field in each Record to a specific, known name.

Keywords:

rename, field, static, specific, name

Configuration:

Configure the 'Record Reader' according to the input format.

Configure the 'Record Writer' according to the desired output format.

Add a property to the Processor such that the name of the property is a RecordPath to identifies the field to rename. The value of the property is the new name of the property.

For example, to rename the name field to full_name, add a property with a name of /name and a value of full_name.

Many properties can be added following this pattern in order to rename multiple fields.



Use Case:

Rename a field in each Record to a name that is derived from a FlowFile attribute.

Keywords:

rename, field, expression language, EL, flowfile, attribute

Configuration:

Configure the 'Record Reader' according to the input format.

Configure the 'Record Writer' according to the desired output format.

Add a property to the Processor such that the name of the property is a RecordPath to identifies the field to rename. The value of the property is an Expression Language expression that can be used to determine the new name of the field.

For example, to rename the addr field to whatever value is stored in the preferred_address_name attribute, add a property with a name of /name and a value of ${preferred_address_name}.

Many properties can be added following this pattern in order to rename multiple fields.



Use Case:

Rename a field in each Record to a new name that is derived from the current field name.

Notes:

This might be used, for example, to add a prefix or a suffix to some fields, or to transform the name of the field by making it uppercase.

Keywords:

rename, field, expression language, EL, field.name

Configuration:

Configure the 'Record Reader' according to the input format.

Configure the 'Record Writer' according to the desired output format.

Add a property to the Processor such that the name of the property is a RecordPath to identifies the field to rename. The value of the property is an Expression Language expression that references the field.name property.

For example, to rename all fields with a prefix of pre_, we add a property named /* and a value of pre_${field.name}. If we would like this to happen recursively, to nested fields as well, we use a property name of //* with the value of pre_${field.name}.

To make all field names uppercase, we can add a property named //* with a value of ${field.name:toUpper()}.

Many properties can be added following this pattern in order to rename multiple fields.



System Resource Considerations:

None specified.

See Also:

UpdateRecord, RemoveRecordField