Log
Use the Log forwarder-type Function to record events from your stream. Events are converted to a string in the form of a message. If the message is larger than 50000 characters, it is truncated.Â
You add a JSON schema to determine what you want to log. If you want to log just part of the output, you can specify which key(s) you want to log. For example, if you have the keys of value, and timestamp but you only want to see the value data in your logs, enter the following:
value
The following appears in the log:
{"value": 1} {"value": 2} {"value": 3}
To view the logs, click Logs in the Stream Editor view. Alternatively, go to the stream list, select your stream and click View Log, or select View Log from the Action drop-down list.
For an example of how to use this function in a stream, see My First Stream.
Syntax
Here are some examples of the keys that you can specify in the Key field to log or record the data using the Log function:
Logging a single field
[ "value" ]
Logging multiple fields
[ "value", "fast", "bar" ]
Logging an object
[ "object" ]
Logging fields from a record with object (nested structure)
For example, if you have a record with the structure of { "brand1": { "model": 1 }, "brand2":Â 2}' and you only want to output the value of model, you can enter the following:
brand1.model
The following appears in the log:
{ "brand1": { "model": 1 } }
Logs View
To view the logs, click Logs in the Stream Editor view. Alternatively, go to the stream list, select your stream and click View Log, or select View Log from the Action drop-down list.
Note!
For an example of how to use this Function in a stream, see My First Stream.
Example Logs Syntax
Import this stream into your Usage Engine service for more information on the syntax used above.
Example stream