0

There are some data in a csv file and it is getting overwritten if the timestamp is similar, for example:

ip,time,name
1.1.1.1,2018-08-31 11:12:32,python
1.2.1.2,2018-08-31 11:05:28,oracle
1.3.1.3,2018-08-31 11:05:28,microsoft
1.4.2.5,2018-08-31 13:15:52,devops

The result in InfluxDB is coming as:

ip,time,name
1.1.1.1,2018-08-31 11:12:32,python
1.3.1.3,2018-08-31 11:05:28,microsoft
1.4.2.5,2018-08-31 13:15:52,devops

The issue is: The second-row record got overwritten by the third rows because the timestamp is same.

I want to insert all record in the InfluxDB.

  • check.. this helps for your issue docs.influxdata.com/influxdb/v0.13/troubleshooting/… – Kamaraj Aug 31 '18 at 7:57
  • Thanks, I have checked this link but can you tell me how I will make IP as unique value. In every file I am getting 98 records and every IP is unique. but what is the command to tell to InfluxDB to that the IP column is unique. – Syed Rizvi Aug 31 '18 at 8:05
0

Try add a unique random number or a sequence number as a tag. Adding a random number as a tag prevents influxdb from overwriting points with the exact same tags and timestamp, since they are considered different points. But there is also a slight chance of conliding.

for example:

ip,time,name,_random
1.1.1.1,2018-08-31 11:12:32,python,65536
1.1.1.1,2018-08-31 11:12:32,python,42

or

ip,time,name,_seq
1.1.1.1,2018-08-31 11:12:32,python,1
1.1.1.1,2018-08-31 11:12:32,python,2

But, you can not use too many numbers for the same tag. Influx by default sets max-tag-per-value to 100000.

  • This DOES answer the question, despite that it's very short. Adding a random number as a tag prevents influxdb from overwriting points with the exact same tags and timestamp. I don't know if this is the best practice, but it IS a way. – ospider Oct 26 '18 at 8:38
  • 1
    In that case I sinserely apologise, but that snippet of information should definitely be added to the answer. Adding random numbers does otherwise seem an odd thing to do. – Kusalananda Oct 26 '18 at 8:41
  • Thanks for your reviewing, I will update the answer. – ospider Oct 26 '18 at 8:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.