NAME
Wubot::Reactor::CopyField - copy the value from one field to another field
VERSION
version 0.2.004
SYNOPSIS
- name: copy value in field 'a' to field 'b'
plugin: CopyField
config:
source_field: a
target_field: b
DESCRIPTION
The CopyField plugin can be used to copy values from one field to another field. You can specify the name of the target field directly in the reactor config, or you can specify the name of a field on the message whose value is the name of the target field.
For example, consider the message:
myfield1: foo
myfield2: bar
The reactor rule:
- name: copy myfield1 to myfield3
plugin: CopyField
config:
source_field: myfield1
target_field: myfield3
Would result in:
myfield1: foo
myfield2: bar
myfield3: foo
If you want to use the value of a message field as the name of the source or target fields, use source_field_name or target_field_name. For example, this rule applied to the original data:
- name: copy myfield1 to myfield3
plugin: CopyField
config:
source_field: myfield1
target_field_name: myfield2
This would look up the value of myfield1 in the message (foo), and set that to the field named in myfield2 (bar):
myfield1: foo
myfield2: bar
bar: foo