Àm trying to insert multiple data rows in table from json string but every time only the last row is getting inserted in the table.
Following is the json string format
[
{
“DataType”: 17,
“Data_Value”: 6,
“Channel”: “LDD.Ethernet.NRT”,
“Connection”: “192.168.5.110”,
“DriveParameter”: “0x2010:003 Device event monitor: Event status”,
“Identifier”: “null”,
“InitTime”: “2021-01-25T07:11:00.3166154+00:00”,
“LastChangedTime”: “0001-01-01T00:00:00+00:00”,
“LastReadTime”: “2021-01-25T07:12:59.1234932+00:00”,
“DeviceError”: “false”,
“Topic”: “EVENT”,
“Event”: “Interval”,
“name”: “DeviceDataContract”
}
,
{
“DataType”: 15,
“Data_Value”: 6,
“Channel”: “LDD.Ethernet.NRT”,
“Connection”: “192.168.5.111”,
“DriveParameter”: “0x2010:004 Device event monitor: Event tracking”,
“Identifier”: “null”,
“InitTime”: “2021-01-26T07:11:00.3166154+00:00”,
“LastChangedTime”: “0001-01-01T00:00:00+00:00”,
“LastReadTime”: “2021-01-25T07:12:59.1234932+00:00”,
“DeviceError”: “false”,
“Topic”: “EVENT”,
“Event”: “Interval”,
“name”: “DeviceDataContract”
}
]
Franky1
February 18, 2021, 3:08pm
2
Please post your input plugin configuration here.
I suspect a problem with the timestamp (configuration).
There must be a timestamp in the json and it must also be configured where to find it.
Maybe the format of the timestamp doesn’t fit either.
Otherwise, by default the current time will be used for all created metrics.
Please read the documentation about the json input config carefully:
###############################################################################
INPUT PLUGINS
###############################################################################
User defined
[[processors.converter]]
[processors.converter.tags]
measurement = [“topic”]
Read metrics from MQTT topic(s)
[[inputs.mqtt_consumer]]
servers = [“localhost:1883”]
##servers = [“10.255.201.118:1883”]
MQTT QoS, must be 0, 1, or 2
qos = 0
Topics to subscribe to
topics = [
“Lenze”,
“ASSET”,
“EVENT”,
“PROCESS”,
“CONNECT”,
“Oscillogram”
]
if true, messages that can’t be delivered while the subscriber is offline
will be delivered when it comes back (such as on service restart).
NOTE: if true, client_id MUST be set
persistent_session = false
If empty, a random client ID will be generated.
client_id = “”
username and password to connect MQTT server.
username = “telegraf”
password = “pwd”
data_format = “json”
json_string_fields = [“Channel”,“Connection”,“DriveParameter”,“Identifier”,“InitTime”,“LastChangedTime”,“LastReadTime”,“DeviceError”]