Mapping Telegraf/InfluxDB metrics to the Timestream for LiveAnalytics model - Amazon Timestream

Mapping Telegraf/InfluxDB metrics to the Timestream for LiveAnalytics model

When writing data from Telegraf to Timestream for LiveAnalytics, the data is mapped as follows.

  • The timestamp is written as the time field.

  • Tags are written as dimensions.

  • Fields are written as measures.

  • Measurements are mostly written as table names (more on this below).

The Timestream for LiveAnalytics output plugin for Telegraf offers multiple options for organizing and storing data in Timestream for LiveAnalytics. This can be described with an example which begins with the data in line protocol format.

weather,location=us-midwest,season=summer temperature=82,humidity=71 1465839830100400200 airquality,location=us-west no2=5,pm25=16 1465839830100400200

The following describes the data.

  • The measurement names are weather and airquality.

  • The tags are location and season.

  • The fields are temperature, humidity, no2, and pm25.

Storing the data in multiple tables

You can choose to create a separate table per measurement and store each field in a separate row per table.

The configuration is mapping_mode = "multi-table".

  • The Timestream for LiveAnalytics adapter will create two tables, namely, weather and airquality.

  • Each table row will contain a single field only.

The resulting Timestream for LiveAnalytics tables, weather and airquality, will look like this.

time location season measure_name measure_value::bigint

2016-06-13 17:43:50

us-midwest

summer

temperature

82

2016-06-13 17:43:50

us-midwest

summer

humidity

71

time location measure_name measure_value::bigint

2016-06-13 17:43:50

us-midwest

no2

5

2016-06-13 17:43:50

us-midwest

pm25

16

Storing the data in a single table

You can choose to store all the measurements in a single table and store each field in a separate table row.

The configuration is mapping_mode = "single-table". There are two addition configurations when using single-table, single_table_name and single_table_dimension_name_for_telegraf_measurement_name.

  • The Timestream for LiveAnalytics output plugin will create a single table with name <single_table_name> which includes a <single_table_dimension_name_for_telegraf_measurement_name> column.

  • The table may contain multiple fields in a single table row.

The resulting Timestream for LiveAnalytics table will look like this.

time location season <single_table_dimension_name_ for_telegraf_measurement_name> measure_name measure_value::bigint

2016-06-13 17:43:50

us-midwest

summer

weather

temperature

82

2016-06-13 17:43:50

us-midwest

summer

weather

humidity

71

2016-06-13 17:43:50

us-midwest

summer

airquality

no2

5

2016-06-13 17:43:50

us-midwest

summer

weather

pm25

16