Ingesting via Influx Line Protocol Stream data to Sift using an Influx client
Credentials
Before starting this section be sure to retrieve your API key and the appropriate Sift URL for your provisioned environment. Instructions on how to retrieve the API key and URL and can be found in the authentication section of the documentation.
Your Sift API key will be used as Influx authentication token. Additionally, you'll send a small amount of configuration as a base64
encoded JSON object via the Influx org
property. Here is the format for the configuration object:
{
// Optional. Run information
"run" : {
// Required
"name" : "your run name" ,
// Required. Different runs can have the same name. This is an opaque key
// used to differentiate runs with the same name.
"run_key" : "a unique identifier for this run"
// Optional. These are tags in the Sift system. They cannot contain spaces.
"tags" [ "any" , "tags" , "associated" , "with" , "this" , "run" ],
},
// Optional. By default, the bucket is added to the set of Influx tags using
// the key "bucket". If set, this renames that key.
"map_bucket_to_tag" : "" ,
// Optional. By default, the bucket is added to the set of Influx tags.
// If true, this removes the bucket from teh set of Influx tags.
"omit_bucket" : false ,
// Required.
// The Influx tags used to create the asset name. The tags values
// are join with an underscore. For example, if the Influx tag
// values are
//
// tag-2=world,tag-1=hello
//
// The asset name will be "hello_world" (tag order here is respected).
// The Influx bucket can be retrieved using the tag "bucket"
// (or whatever you renamed it to via "map_bucket_to_tag").
"asset_source_tags" : [ "tag-1" , "tag-2" ]
}
The Influx "measure" is used for the Sift channel component. Any Influx tags that aren't used as for the asset will become part of the channel component.
Given the following Influx line protocol sent to the "CA" bucket:
readings,name=truck_0,fleet=West,model=G-2000,device_version=v2.3 latitude=88.177,longitude=168.95208,elevation=420,velocity=22,heading=61 1451692700000000000
And the following configuration object:
{
"run" : {
"name" : "vehicle stats" ,
"key" : "372f7888-ad93-4189-b577-1644ca503413"
},
"asset_source_tags" : [ "fleet" , "bucket" , "name" ]
}
This generates the following channels / data:
"asset": "West_CA_truck_0"
"component: "readings(device_version:v2.3)(model:G-2000)"
"timestamp": "2023-08-09T15:24:15+00:00"
"name": "latitude"
"value": 88.177
"asset": "West_CA_truck_0"
"component: "readings(device_version:v2.3)(model:G-2000)"
"timestamp": "2023-08-09T15:24:15+00:00"
"name": "longitude"
"value": 168.95208
"asset": "West_CA_truck_0"
"component: "readings(device_version:v2.3)(model:G-2000)"
"timestamp": "2023-08-09T15:24:15+00:00"
"name": "elevation"
"value": 420
"asset": "West_CA_truck_0"
"component: "readings(device_version:v2.3)(model:G-2000)"
"timestamp": "2023-08-09T15:24:15+00:00"
"name": "velocity"
"value": 22
"asset": "West_CA_truck_0"
"component: "readings(device_version:v2.3)(model:G-2000)"
"timestamp": "2023-08-09T15:24:15+00:00"
"name": "heading"
"value": 61