Writing data to IndluxFB

Hi, Im having issues getting data into influx, I would like to use my time stamp in the logs not the timestamp of the current time and I have a JSON object of all the various values to store for each time. I have been using the influxdb out node to simply write a single value but i'm now expanding.

my flow is

[{"id":"707fc5c5.ea6dcc","type":"debug","z":"e7262fe9.ed296","name":"CSV Compare","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":740,"y":120,"wires":[]},{"id":"913b2d0b.08f7e","type":"file in","z":"e7262fe9.ed296","name":"","filename":"/share/TEST3.csv","format":"lines","chunk":false,"sendError":false,"encoding":"none","x":270,"y":120,"wires":[["5efdb887.bab9d8"]]},{"id":"8c4a40da.9166e","type":"inject","z":"e7262fe9.ed296","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":"","topic":"","payload":"","payloadType":"date","x":80,"y":120,"wires":[["913b2d0b.08f7e"]]},{"id":"5efdb887.bab9d8","type":"csv","z":"e7262fe9.ed296","name":"","sep":",","hdrin":true,"hdrout":"none","multi":"one","ret":"\\n","temp":"","skip":"0","strings":true,"include_empty_strings":true,"include_null_values":true,"x":450,"y":120,"wires":[["707fc5c5.ea6dcc","b05b1b0e.8ace78"]]},{"id":"a8451793.4723b8","type":"debug","z":"e7262fe9.ed296","name":"CSV Start","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":720,"y":220,"wires":[]},{"id":"b05b1b0e.8ace78","type":"function","z":"e7262fe9.ed296","name":"","func":"// create object and populate with Influx tags\nvar tags = {}\ntags.node = msg.filename\n\n// create object for measurement values\nvar v = {}\nv.value = msg.payload // the measurement value\n\n// create and fill array for the payload\nvar arr = [] \narr[0] = v            // the measurement value\narr[1] = tags\n\n// put the array into msg.payload and send it off\nmsg.payload = arr\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":580,"y":180,"wires":[["a8451793.4723b8","5f52ac8f.3a05b4"]]},{"id":"5f52ac8f.3a05b4","type":"influxdb batch","z":"e7262fe9.ed296","influxdb":"9d1d55a0.2f7ac8","precision":"s","retentionPolicy":"","name":"","x":790,"y":180,"wires":[]},{"id":"9d1d55a0.2f7ac8","type":"influxdb","hostname":"127.0.0.1","port":"8086","protocol":"http","database":"test","name":"","usetls":false,"tls":"d50d0c9f.31e858","influxdbVersion":"1.8-flux","url":"http://localhost:8086","rejectUnauthorized":true},{"id":"d50d0c9f.31e858","type":"tls-config","name":"","cert":"","key":"","ca":"","certname":"","keyname":"","caname":"","servername":"","verifyservercert":false}]

and the last thing before the influx batch node is

{"payload":[{"value":{"time":1582963394,"TWS":4.27,"TWD":255.1,"HDG":57.9,"Lat":-33.84757088,"Lon":151.2045955,"COG":-18.21666667,"SOG":0.078,"TWD+90":119.5,"TWD-90":299.5,"Mk Lat":-33.8571377,"Mk Lon":151.2539832,"U1 PTWS":5.413607,"U2 PTWDTC":278.683209,"U3 TWS":4.266739,"U6 PTWDT":267.788934,"U7 PHDGT":58.542436}},{"node":"/share/TEST3.csv"},"RegardlesLog"],"filename":"/share/TEST3.csv","parts":{"index":4,"ch":"\n","type":"string","id":"92398551.9305c8","count":null},"_msgid":"e85a1c01.3edcb","columns":"time,TWS,TWD,HDG,Lat,Lon,COG,SOG,TWD+90,TWD-90,Mk Lat,Mk Lon,U1 PTWS,U2 PTWDTC,U3 TWS,U6 PTWDT,U7 PHDGT","measurement":"RegardlesLog"}

I got errors when writing this to a influx 1.0 db but a 1.8 seemed happy however i don't know how i specify the DB to wright to and I don't see any of these values in my DB?

Its a bit of a mess after trying so many things so apologies if there is unneccicary bits in the JSON formatting

Do you mean 2.0?

What error are you getting?

I always use the batch node when I have a timestamp to write, though I have not moved to V2 yet.

Hold on, that isn't a valid payload for the influx batch node. It should be an array of points each containing fields, tags, timestamp and optional measurement.
However, I notice that you have selected 1.8-flux, and I don't know in detail what that means. It seems there isn't a way to specify the db when flux mode is selected.
I think that if you are using a normal 1.8 setup then select 1.x not 1.8-flux.

Ok, good point ill put the DB back down to no flux i feel like it was better documented.

I'm not exactly sure what the difference is between what I have as a payload and what works form one of the demo nodes, there is some extra junk outside the payload but i guess that just gets ignored as the node help only talks about the msg.payload?

Im using the Influx Batch node so that seems fine and so my 'time' key value pair are what im hoping it uses?

To quote from the help text for the batch node:

"The msg.payload needs to be an array of point objects.
The measurement property of a point contains the name of the measurement for the point. The fields property will contain the fields of the point. If supplied, the tags property will contain the tags for the point. To set the time for the point, supply a timestamp property."

That doesn't seem to bear much similarity with what you are providing. You are providing an array (of one element) but I don't see in there the fields, tags or timestamp property, so I have no idea at all how it is working, if it is working.

Hi Colin,
My problem is I don't have the vocabulary, a bit like Cole Trickle...
I is the measurement 'property' a key of 'measurement' or just any of my key:value pairs, do i have to define a key of measurement for it to accept and know how to deal with it?
Feilds and points i cant see much reference to when i google JSON stuff?
Sorry, im sure these are very dumb questions but i cant match the node documentation to anything i know about.

It's nothing to do with node-red or node, it is Influxdb. In influxdb there are Databases, Measurements (similar to tables in a conventional database), Fields and Tags.