Template Engine
The EdgeIQ Template Engine allows users to reference dynamic data from within our system or from an incoming report. It's especially useful to customize the data sent to external systems from a policy action.
Syntax
Anything enclosed in double "curly braces": {{ }}
will be interpreted by the template engine. Inside the brackets, you must start with either a keyword or a dot notated reference to any available context data.
Context Data
Context data is data that is available to be referenced and embedded in a template. Context data should be referenced using dot notation and the value referenced should be a string
or number
unless using the json_object
prefix.
Report
.Report.Payload.your_payload_field
Device
.Device.Name
.Device.UniqueID
.Device.Metadata.your_metadata_field
DeviceType
.DeviceType.Name
.DeviceType.Manufacturer
.DeviceType.Model
.DeviceType.Type
.DeviceType.LongDescription
.DeviceType.Metadata.your_metadata_field
Functions
Functions are keywords that provide a way to transform data from the template's context to a string of text in the output of the template.
Function Name | Description | Example |
---|---|---|
json_object | Marshals the referenced object into a JSON string | {{ json_object .Report.Payload }} |
timestamp | Adds an RFC 3339 date time string at the current time (the time the template is parsed) in the UTC +0 timezone - example 2022-03-04T21:49:27.801Z | {{ timestamp }} |
fmtTimestamp | Adds a date time string at the current time according to the format string given as an argument. For a format string, you can use a "fake" date with the elements you wish to include. Examples:2006-01-02 2006-01-02T15:04:05.999Z07:00 | {{ fmtTimestamp "2006-01-02" }} |
Updated about 1 year ago