Periodically write a .CSV-file

My Influx database with name “lucht” is running on a Raspberry Pi and has authentication disabled. It is my intention to export the data to a .CSV-file.

I found some tips like https://www.quora.com/How-can-I-extract-data-from-influxDB-to-external-files but I’m completely newbee and don’t know how to convert this to my preference so I need help from more experienced InfluxDB users.

This is what I would like to use:

Automatically write the last 100 records from “lucht” to “etc/influxdb/csv-data/lucht.csv” every 10 minutes.

Hope someone is willing to send me the right commandline.

You need to understand key concepts, what is database and what is measurement. Check the InfluxDB key concepts | InfluxDB OSS 1.8 Documentation, please.
Then, change the database and query in cmd line from the link you found and it will work for you.

Thanks for helping. In the image you can see the structure of my database “lucht”. If I run the following line from root via SSH:

influx -database lucht -format csv -execute "select n from tab1 limit 100"> temp.csv

The file temp.csv is created (without errors), but it is empty. Can you tell me what I’m doing wrong?

It is a pity to see that there are so few comments on this forum. I am forced to look elsewhere for a solution. :smirk:

Hello @HansIDB,
I think the easiest way to do this is with a client. What’s your preferred language?

Thanks Anaisdg. For now I have found a solution including a crontab:

*/10 * * * * influx -database 'lucht' -execute 'select * from lucht limit 150' -format 'csv'> ./CSV/lucht.csv 

I don’t know if it will win a beauty award but it works fine.

Hello @HansIDB,
oh great! yah that’s a simple solution that works great.