Supported Variables/APIs
To use JavaScript in Usage Engine, there are some mandatory variables and APIs that you require.
Variables/Functions | Description | Examples |
---|---|---|
audit | To control the custom user audit function. The supported types are:
Syntaxaudit.count(key);
Syntaxaudit.sum(key,value);
Syntaxaudit.set(key,value);
|
Example - audit.set
Example - audit.sum
Example - audit.count
|
| An object that contains logging functionality for the severity levels: info, warning, and error.
|
|
The
| ||
| The The following metadata is accessible using the Script Flush tab:
| |
| To send data downstream. You need to invoke this Function using | To send data to the next Function(s) in the stream.
|
This is to keep the state across records. The state is only available during one stream execution. The information stored in the The
|
| |
These three operations functions as a key-value store. The key must be a string. Value can be of any type, for example: string, number, date, JSON object, and array.
|
| |
With shared persistent storage, streams can access the same data. For example, one stream writes data to the shared persistent storage that can be used by one or more streams. The key must be a string. Value can be of any type, for example, string, number, date, JSON object, and array.
You must use the
|
|
Error message example
This simplistic example shows the log when the keyword "payload" is spelled with a capital 'P'. The following example uses the Summarize Monthly Usage Data example stream.