Skip to content

Latest commit

 

History

History
283 lines (235 loc) · 4.66 KB

File metadata and controls

283 lines (235 loc) · 4.66 KB

move operator

The move operator moves (or renames) a field from one location to another.

It's configured by passing 'to' and 'from' fields.

Configuration Fields

Field Default Description
id move 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 move the value out of.
to required The field to move 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:

Rename value

- type: move
  from: key1
  to: key3
Input Entry Output Entry
{
  "resource": { },
  "labels": { },  
  "record": {
    "key1": "val1",
    "key2": "val2"
  }
}
{
  "resource": { },
  "labels": { },  
  "record": {
    "key3": "val1",
    "key2": "val2"
  }
}

Move a value from the record to resource

- type: move
  from: uuid
  to: $resoruce.uuid
Input Entry Output Entry
{
  "resource": { },
  "labels": { },  
  "record": {
    "uuid": "091edc50-d91a-460d-83cd-089a62937738"
  }
}
{
  "resource": { 
    "uuid": "091edc50-d91a-460d-83cd-089a62937738"
  },
  "labels": { },  
  "record": { }
}

Move a value from the record to labels

- type: move
  from: ip
  to: $labels.ip
Input Entry Output Entry
{
  "resource": { },
  "labels": { },  
  "record": {
    "ip": "8.8.8.8"
  }
}
{
  "resource": { },
  "labels": { 
    "ip": "8.8.8.8"
  },  
  "record": { }
}

Replace the record with an individual value nested within the record

- type: move
  from: log
  to: $record
Input Entry Output Entry
{
  "resource": { },
  "labels": { },  
  "record": {
    "log": "The log line"
  }
}
{
  "resource": { },
  "labels": { },  
  "record": "The log line"
}

Remove a layer from the record

- type: move
  from: wrapper
  to: $record
Input Entry Output Entry
{
  "resource": { },
  "labels": { },  
  "record": {
    "wrapper": {
      "key1": "val1",
      "key2": "val2",
      "key3": "val3"
    }
  }
}
}
{
  "resource": { },
  "labels": { },  
  "record": {
    "key1": "val1",
    "key2": "val2",
    "key3": "val3"
  }
}

Merge a layer to the record

- type: move
  from: wrapper
  to: $record
Input Entry Output Entry
{
  "resource": { },
  "labels": { },  
  "record": {
    "wrapper": {
      "key1": "val1",
      "key2": "val2",
      "key3": "val3"
    },
      "key4": "val1",
      "key5": "val2",
      "key6": "val3"
  }
}
{
  "resource": { },
  "labels": { },  
  "record": {
    "key1": "val1",
    "key2": "val2",
    "key3": "val3",
    "key4": "val1",
    "key5": "val2",
    "key6": "val3"
  }
}