The copy operator copies a value from one field to another.
| Field | Default | Description |
|---|---|---|
id |
copy |
A unique identifier for the operator |
output |
Next in pipeline | The connected operator(s) that will receive all outbound entries |
from |
required | The field to copy the value of. |
to |
required | The field to copy the value into. |
on_error |
send |
The behavior of the operator if it encounters an error. See on_error |
if |
An expression that, when set, will be evaluated to determine whether this operator should be used for the given entry. This allows you to do easy conditional parsing without branching logic with routers. |
Example usage:
Copy a value from the record to resource
- type: copy
from: key
to: $resource.newkey| Input Entry | Output Entry |
{
"resource": { },
"labels": { },
"record": {
"key":"value"
}
} |
{
"resource": {
"newkey":"value"
},
"labels": { },
"record": {
"key":"value"
}
} |
Copy a value from the record to labels
- type: copy
from: key2
to: $labels.newkey| Input Entry | Output Entry |
{
"resource": { },
"labels": { },
"record": {
"key1": "val1",
"key2": "val2"
}
} |
{
"resource": { },
"labels": {
"newkey": "val2"
},
"record": {
"key3": "val1",
"key2": "val2"
}
} |
Copy a value from labels to the record
- type: copy
from: $labels.key
to: newkey| Input Entry | Output Entry |
{
"resource": { },
"labels": {
"key": "newval"
},
"record": {
"key1": "val1",
"key2": "val2"
}
} |
{
"resource": { },
"labels": {
"key": "newval"
},
"record": {
"key3": "val1",
"key2": "val2",
"newkey": "newval"
}
} |
Copy a value within the record
- type: copy
from: obj.nested
to: newkey| Input Entry | Output Entry |
{
"resource": { },
"labels": { },
"record": {
"obj": {
"nested":"nestedvalue"
}
}
} |
{
"resource": { },
"labels": { },
"record": {
"obj": {
"nested":"nestedvalue"
},
"newkey":"nestedvalue"
}
} |