Datapoint Logs
You can use datapoint logs to maintain a historical record of selected datapoint values. You can use historical datapoint values for displaying trends, data analytics, and historical reference. You can use the CMS to specify which datapoints to log, how often to log them, and how long to retain them. You can specify the same parameters using IAP/REST requests as described on this page. You can also delete datapoints from the log using IAP/REST requests as described on this page.
Additional methods of viewing the data that has been added to the log file is described in Datapoint Monitor or Log Events.
You can specify up to three logging interval/retention period pairs for each datapoint to prune data as it ages and manage the maximum log size. For example, log specifications for an energy datapoint may specify a 5-minute interval data to be retained for a week, 1-hour interval data to be retained for 6 months, and daily data to be retained for 5 years. The retention intervals are requests since the amount of data that can be retained is limited by available storage. The three logging levels in this example mean that you can displfay an energy trend chart with up to 5 minute resolution for the previous week, up to hourly resolution for the six months, and up to daily resolution for the previous 5 years. The data outside the retention periods is pruned to save storage space.
There can be multiple historical datapoint values returned in response to a request. The values are sorted by UTC timestamp.
URI Definition
Method | URI and Fields | |||||||||||||||||||||
GET | /iap/devs/{id}/if/{block}/{block_index}/{datapoint_name}/logs | |||||||||||||||||||||
Returns the properties describing the logging configuration for the specified datapoints and log levels. Historical datapoint values can be stored for use for trend display, data analytics, and historical reference. Up to three logging interval/retention period pairs can be specified to prune data as it ages. XIFname vs Instance Name
Path ParametersThe optional path parameters for the id, block, block_index, and datapoint_name path elements are listed on the Path Parameters page. Example
| ||||||||||||||||||||||
/iap/devs/{id}/if/{block}/{block_index}/{datapoint_name}/logs/minDeltaValue | ||||||||||||||||||||||
Returns the properties describing the logging configuration for the specified datapoints and log levels. The logging configuration specifies up to three levels of data retention policy for a datapoint. The level value is the log level, and can have a value of "1", "2", or "3". The configuration and meaning of the log levels is defined by the user as described in Defining Datapoint Properties. Datapoint values are logged with a tag of log_level_1, log_level_2, or log_level_3 representing the log level for the logged datapoint. A logged datapoint may have multiple log_level_x tags if the datapoint is logged as the result of two or more log level specifications at the same time. The minDeltaValue property specifies the required minimum change of value from the last logged value to log an updated value. Set to "any", "always", or a scalar value, where:
The default for minDeltaValue is "any". XIFname vs Instance Name
Path ParametersThe optional path parameters for the id, block, block_index, and datapoint_name path elements are listed on the Path Parameters page. Example
| ||||||||||||||||||||||
/iap/devs/{id}/if/{block}/{block_index}/{datapoint_name}/logs/minDeltaTime | ||||||||||||||||||||||
Returns the properties describing the logging configuration for the specified datapoints and log levels. The logging configuration specifies up to three levels of data retention policy for a datapoint. The level value is the log level, and can have a value of "1", "2", or "3". The configuration and meaning of the log levels is defined by the user as described in Defining Datapoint Properties. The minDeltaTime property specifies the minimum number of seconds between logged values. If 0, there is no time throttle. Defaults to "0" to disable the throttle. XIFname vs Instance Name
Path ParametersThe optional path parameters for the id, block, block_index, and datapoint_name path elements are listed on the Path Parameters page. | ||||||||||||||||||||||
/iap/devs/{id}/if/{block}/{block_index}/{datapoint_name}/logs/{level} | ||||||||||||||||||||||
The following fields are returned if minDeltaValue or minDeltaTime are not specified:
The logging configuration specifies up to three levels of data retention policy for a datapoint. The level value is the log level, and can have a value of "1", "2", or "3". The configuration and meaning of the log levels is defined by the user as described in Defining Datapoint Properties. XIFname vs Instance Name
Path ParametersThe level path element allows you to specify a log level. The optional path parameters for the id, block, block_index, and datapoint_name path elements are listed on the Path Parameters page. | ||||||||||||||||||||||
/iap/devs/{id}/if/{block}/{block_index}/{datapoint_name}/logs/value/{value_param} | ||||||||||||||||||||||
Returns the historical values for the specified datapoint. There can be multiple historical datapoint values returned to a request. The values are sorted by UTC timestamp. Each Data Log Value GET response will be an JSON encoded value with the following fields:
XIFname vs Instance Name
Path ParametersThe value_param path element allows you to specify a value. The optional path parameters for the id, block, block_index, and datapoint_name path elements are listed on the Path Parameters page. | ||||||||||||||||||||||
PUT | /iap/devs/{id}/if/{block}/{block_index}/{datapoint_name}/logs/minDeltaValue | |||||||||||||||||||||
Sets properties specifying the logging configuration for the specified datapoints and log levels. The minDeltaValue property specifies the required minimum change of value from the last logged value to log an updated value. Returns "any", "always", or a scalar value, where:
The default for minDeltaValue is "any". The logging configuration specifies up to three levels of data retention policy for a datapoint. The level value is the log level, and can have a value of "1", "2", or "3". The configuration and meaning of the log levels is defined by the user as described in Defining Datapoint Properties. Datapoint values are logged with a tag of log_level_1, log_level_2, or log_level_3 representing the log level for the logged datapoint. A logged datapoint may have multiple log_level_x tags if the datapoint is logged as the result of two or more log level specifications at the same time. XIFname vs Instance Name
Path ParametersThe optional path parameters for the id, block, block_index, and datapoint_name path elements are listed on the Path Parameters page. | ||||||||||||||||||||||
/iap/devs/{id}/if/{block}/{block_index}/{datapoint_name}/logs/minDeltaTime | ||||||||||||||||||||||
Sets properties specifying the logging configuration for the specified datapoints and log levels. The minDeltaTime property specifies the minimum number of seconds between logged values. If 0, there is no time throttle. Defaults to "0" to disable the throttle. The logging configuration specifies up to three levels of data retention policy for a datapoint. The level value is the log level, and can have a value of "1", "2", or "3". The configuration and meaning of the log levels is defined by the user through DLA files, as described in Creating a DLA File in Defining Datapoint Properties. XIFname vs Instance Name
Path ParametersThe optional path parameters for the id, block, block_index, and datapoint_name path elements are listed on the Path Parameters page. | ||||||||||||||||||||||
/iap/devs/{id}/if/{block}/{block_index}/{datapoint_name}/logs/{level} | ||||||||||||||||||||||
Sets properties specifying the logging configuration for the specified group of datapoints and log levels. Any of the following fields can be specified for a level if minDeltaValue or minDeltaTime are not specified:
The logging configuration specifies up to three levels of data retention policy for a datapoint. The level value is the log level, and can have a value of "1", "2", or "3". The configuration and meaning of the log levels is defined by the user through DLA files, as described in Creating a DLA File in Defining Datapoint Properties. XIFname vs Instance Name
Path ParametersThe level path element allows you to specify a log level. The optional path parameters for the id, block, block_index, and datapoint_name path elements are listed on the Path Parameters page. | ||||||||||||||||||||||
DELETE | /iap/devs/{id}/if/{block}/{block_index}/{datapoint_name}/logs/minDeltaValue | |||||||||||||||||||||
If minDeltaValue is specified, the specified property is set to "0". XIFname vs Instance Name
Path ParametersThe optional path parameters for the id, block, block_index, and datapoint_name path elements are listed on the Path Parameters page. | ||||||||||||||||||||||
/iap/devs/{id}/if/{block}/{block_index}/{datapoint_name}/logs/minDeltaTime | ||||||||||||||||||||||
If minDeltaTime is specified, the specified property is set to "0". XIFname vs Instance Name
Path ParametersThe optional path parameters for the id, block, block_index, and datapoint_name path elements are listed on the Path Parameters page. | ||||||||||||||||||||||
/iap/devs/{id}/if/{block}/{block_index}/{datapoint_name}/logs/{level} | ||||||||||||||||||||||
If minDeltaValue or minDeltaTime are not specified, sets the interval to "0" and the retention interval to "0" for the specified log level. XIFname vs Instance Name
Path ParametersThe level path element allows you to specify a log level. The optional path parameters for the id, block, block_index, and datapoint_name path elements are listed on the Path Parameters page. | ||||||||||||||||||||||
/iap/devs/{id}/if/{block}/{block_index}/{datapoint_name}/logs/value/{value_param} | ||||||||||||||||||||||
Deletes the specified historical values from the datapoint log. XIFname vs Instance Name
Path ParametersThe value_param path element allows you to specify a value. The optional path parameters for the id, block, block_index, and datapoint_name path elements are listed on the Path Parameters page. |
Queries
You can include queries with your IAP/REST request to specify a selection rule for your request. As described in Queries and Parameters, you can specify a query as a query parameter appended to the end of your URI preceded with a "?" character, or as a path parameter within a path element of the path component.
The optional path parameters for the id, block, block_index, and datapoint_name path elements are listed on the Path Parameters page.
Logging Configuration
Logging configuration is stored per datapoint.
- If a GET request specifies multiple datapoints, the configuration is returned for each of the datapoints matching the query parameters.
- If a PUT request specifies a configuration to be stored for multiple datapoints, the same configuration is stored for each of the datapoints matching the query parameters.
- If a DELETE request specifies multiple datapoints, the configuration is cleared for each of the datapoints matching the query parameters.
Datapoint Log Value
The Datapoint Log Value GET and DELETE requests can include optional query parameters.
- If a GET request specifies multiple datapoints, the values are returned for each of the datapoints matching the query parameters.
- If a DELETE request specifies multiple datapoints, the historical values are deleted for each of the datapoints matching the query parameters.
Examples
Get all level 1 logged datapoints named nvoEnergy from device 17q2d95.4:
GET /iap/devs/17q2d95.4/if/*/*/*+name==nvoEnergy&tag==log_level_1/logs/value/* |
Get all logged datapoints named nvoEnergy, nvoVoltage, or nvoPwrFactor from device T6tWyg8.3:
GET /iap/devs/T6tWyg8.3/if/*/*/*+name=+^(nvoEnergy)%7C(nvoVoltage)%7C(nvoPwrFactor)/logs/value/* |
To implement the logical or, the | symbol is required, but cannot be included in a URI. To include the logical-or symbol, insert %7C which is the ASCII encoding of the | symbol.
Delete all logged datapoints:
DELETE /iap/devs/*/if/*/*/*/logs/value/* |
A datapoint log response for a logged Lamp nviValue datapoint:
[ {
"id" : 19,
"local" : "2017-08-23 11:34:22.123 BST",
"utc" : "2017-08-23 10:34:22.123 UTC",
"deviceId" : 17q2d95.4,
"blockName" : "Lamp",
"blockIndex" : "0",
"datapointName" : "nviValue",
"deviceState" : "provisioned"
"deviceHealth" : "normal",
"value" : {
"state" : 1,
"value" : 100
}
"tags":[
{"tag1": "data_1"}, |