apiVersion: v1 kind: ConfigMap metadata: name: benthos-yourMachine-config namespace: united-manufacturing-hub labels: app: benthos-yourMachine data: benthos.yaml: |- input: opcua: endpoint: 'opc.tcp://192.168.0.123:4840' nodeIDs: ['ns=4;i=2'] pipeline: processors: - bloblang: | # if matching tag found, change name. let newName = match { meta("opcua_path") == "ns_4_i_3" => "machineNumber", meta("opcua_path") == "ns_4_i_4" => "dataSetNumber", meta("opcua_path") == "ns_4_i_5" => "dataSetName", meta("opcua_path") == "ns_4_i_6" => "controlOn", meta("opcua_path") == "ns_4_i_7" => "fullAutomaticMode", meta("opcua_path") == "ns_4_i_8" => "semiAutomaticMode", meta("opcua_path") == "ns_4_i_9" => "cycleRunning", meta("opcua_path") == "ns_4_i_10" => "errorActive", _ => meta("opcua_path") } # special function to force the values in to strings, due to the specific formatting from the servers root = { $newName: match { meta("opcua_path") == "ns_4_i_3" => content().string(), meta("opcua_path") == "ns_4_i_5" => content().string(), _ => this, }, } # filter unwanted tags - mapping: | root = if meta("opcua_path") == "ns_4_i_15" || meta("opcua_path") == "ns_4_i_16" || meta("opcua_path") == "ns_4_i_17" || meta("opcua_path") == "ns_4_i_18" { deleted() } # convert to json array to get all tags to an json array instead of separate messages - archive: format: json_array # append correct timestamp to array - bloblang: | root = this.append({"timestamp_ms":(timestamp_unix_nano() / 1000000).floor()}) # convert array to a cobined json. - bloblang: | root = this.squash() output: # stdout: {} #logger: # level: DEBUG # format: logfmt # add_timestamp: true mqtt: urls: - 'united-manufacturing-hub-mqtt:1883' topic: 'ia/raw/factoryinsight/yourCompany/machine/opcua' client_id: 'benthos-umh'