I’ve been using telegraf and influx to gather data from logfiles for a long time.
I am now creating a new C++ application for an IoT device with little storage capacity, so would like to get my data directly into influx without parsing log files. It could be directly or via telegraf if needed.
Are there plugins or libraries available for C++ to help me do this? I could not find any, but I would have thought that it would be a common use case. Perhaps a logging library exists that supports influx as standard?
Given your requirements of C++ and trying to use as little space as possible, my suggestion would be to write the log parser in C++ and connect directly from the IoT device to InfluxDB.
You can use whatever libraries you can find to parse the dataformat of the logs or do it yourself in your app. To send the data to InfluxDB you can either make HTTP requests directly against the server or use a library like influxdb-cxx.
If you aren’t already familiar with line protocol, I would suggest reading up on that as well as that is the format of the data you would want to send to InfluxDB if you decide to do it with direct HTTP requests.
As has been mentioned, line protocol is the data interface you can use and it is text-based and simple to implement.
I would like to add that if you feel adding HTTP communication or influxdb-cxx to your project is too complicated, you could also use a simple UDP or TCP connection to Telegraf to send line protocol content:
Use telegraf/plugins/inputs/socket_listener in combination with telegraf/plugins/outputs/influxdb_v2
Using the HTTP, TCP or UDP connections are all possible for me to do, but I expect that influxdb-cxx is going to provide what I need.
I don’t know if that library is robust to network outages but if not, I could extend it.