Skip to content

paStash NG Commands

Lorenzo Mangani edited this page Jan 26, 2019 · 11 revisions

paStash Commands

This WIP outlines the nature of paStash commands and their general usage.

What?

Command filters are pluggable pipeline functions users can inject in their logic using npm modules. Example:

  .filter('method', 'INVITE')
  .groupBy('response')
  .divide('timestamp',1000,data)
  .data(data)

Usage

In order to understand the potential usage of command filters we'll create a simple custom plugin providing a divide and multiply set of commands to our pipeline.

The custom plugin (and any other) will be loaded at runtime via the plugins property of our filter:

input {
  stdin{}
}

filter {
  json_fields {}
  command {
    debug => false
    cmd => ".divide('age',2,data).multiply('eyes',2,data).data(data)"
    plugins => ['@pastash/command_chain','@pastash/command_math']
  }
}

output {
  stdout {}
}

Feed it!

The following input should transverse the command pipeline and return all changes to the output:

[{ "sex": "male", "age": 35, "eyes": 2 },{ "sex": "female", "age": 38, "eyes": 2 },{ "sex": "male", "age": 29, "eyes": 2 }]
TO BE CONTINUED
Clone this wiki locally