I have an requirement to extract a value from an mqtt string before i parse it to json. Initially i was using MQTT Modular input app to pull each of the topics with their own input. I found that w...
See more...
I have an requirement to extract a value from an mqtt string before i parse it to json. Initially i was using MQTT Modular input app to pull each of the topics with their own input. I found that with more than 3 inputs /topics enabled i am dropping some if not all data. So i decided to pull all the topics in a single input. This works well except i still need to be able to separate the topics for searches. I managed to get this working using multiple transforms. i changed something and now i can get it to work again. Using Transforms i can parse to json with no issues (mqtttojson) Transforms.conf [mqtttojson] REGEX = msg\=(.+)$ FORMAT = $1 DEST_KEY = _raw [mqtttopic] CLEAN_KEYS = 0 FORMAT = Topic::"$1" REGEX = tgw\/data\/0x155f\/(?<Topic>\S*?)\/ Props.conf [mqtttojson_ubnpfc_all] DATETIME_CONFIG = LINE_BREAKER = ([\r\n]+) NO_BINARY_CHECK = true TIME_PREFIX = \"ts\": TZ = Europe/London category = Custom pulldown_type = 1 TRANSFORMS-mqtttopic = mqtttojson, mqtttopic In the example below i need the 4th topic level i.e. "TransportContextTracking". Thu Apr 24 12:42:15 GMT 2025 name=mqtt_msg_received event_id= topic=tgw/data/0x155f/TransportContextTracking/MFC/0278494 msg={"data":{"destination":{"locationAddress":"/UrbanUK/PCOTS13/Exit"},"errorCode":null,"event":"Started","loadCarrierId":"0278494","source":{"locationAddress":"/UrbanUK/PCOTS13/Pick"},"transportId":"f0409b2a-e9d4-407c-bd65-48ccea17b520","transportType":"Transport"},"dbid":8104562815,"ts":1745498528217} What am i missing ?????