Rename Filter¶
The foglamp-filter-rename filter that can be used to modify the name of an asset, datapoint or both. It may be used either in South services or North services or North tasks.
To add a Rename filter
Click on the Applications add icon for your service or task.
Select the rename plugin from the list of available plugins.
Name your Rename filter.
Click Next and you will be presented with the following configuration page
Configure the plugin
Operation: Search and replace operation be performed on asset name, datapoint name or both
Find: A regular expression to match for the given operation
Replace With: A substitution string to replace the matched text with
Enable the filter and click on Done to activate it
Example¶
The simplest following example perform on given below reading object
{
"readings": {
"sinusoid": -0.978147601,
"a": {
"sinusoid": "2.0"
}
},
"asset": "sinusoid",
"id": "a1bedea3-8d80-47e8-b256-63370ccfce5b",
"ts": "2021-06-28 14:03:22.106562+00:00",
"user_ts": "2021-06-28 14:03:22.106435+00:00"
}
To replace an asset apply a configuration would be as follows
Operation : asset
Find : sinusoid
Replace With : sin
Output
{
"readings": {
"sinusoid": -0.978147601,
"a": {
"sinusoid": 2.0
}
},
"asset": "sin",
"id": "a1bedea3-8d80-47e8-b256-63370ccfce5b",
"ts": "2021-06-28 14:03:22.106562+00:00",
"user_ts": "2021-06-28 14:03:22.106435+00:00"
}
To replace a datapoint apply a configuration would be as follows
Operation : datapoint
Find : sinusoid
Replace With : sin
Output
{
"readings": {
"sin": -0.978147601,
"a": {
"sin": 2.0
}
},
"asset": "sinusoid",
"id": "a1bedea3-8d80-47e8-b256-63370ccfce5b",
"ts": "2021-06-28 14:03:22.106562+00:00",
"user_ts": "2021-06-28 14:03:22.106435+00:00"
}
To replace both asset and datapoint apply a configuration would be as follows
Operation : both
Find : sinusoid
Replace With : sin
Output
{
"readings": {
"sin": -0.978147601,
"a": {
"sin": 2.0
}
},
"asset": "sin",
"id": "a1bedea3-8d80-47e8-b256-63370ccfce5b",
"ts": "2021-06-28 14:03:22.106562+00:00",
"user_ts": "2021-06-28 14:03:22.106435+00:00"
}
See Also¶
foglamp-filter-asset - A FogLAMP processing filter that is used to block or allow certain assets to pass onwards in the data stream
foglamp-filter-enumeration - A filter to map between symbolic names and numeric values in a datapoint.
foglamp-filter-metadata - A FogLAMP processing filter plugin that adds metadata to the readings in the data stream
foglamp-filter-normalise - Normalise the timestamps of all readings that pass through the filter. This allows data collected at different rate or with skewed timestamps to be directly compared.
foglamp-filter-python35 - A FogLAMP processing filter that allows Python 3 code to be run on each sensor value.