Use
This node executes a JavaScript function and returns the output in the msg.payload. You can create conditional output, or multiple outputs in an array.
Properties
Attribute | Values | Remarks |
---|
Name | any string | Enter a self-explaining name of the node. If you leave this field empty, the generic name displays in the dashboard. |
Setup | any JavaScript | Code that you enter here is executed once whenever the node is deployed. Initializes any values in the node context that are required for the function. For example, a counter. |
Function | any JavaScript | Enter a JavaScript function. Input variable is usually msg.payload. Return values are passed into the msg.payload as well. |
Outputs | any integer | If the function creates more than one output, this value can be set to return an array with different messages to the outputs. For example, if a function returns [null, msg], the first output is NULL, the second output contains the payload. |
Close | any JavaScript | Code that you enter here is executed when the node is stopped or re-deployed. Cleans up outstanding requests or closes connections. |
Example
Integration with Logstash and ElasticSearch