You can collect data from server-side applications, games, and IoT devices that are based in C++. This article describes how to reliably import data from your C and C++ applications, using Fluent Bit.
Basic knowledge of C/C++ Application Development.
Basic knowledge of Treasure Data.
About Fluent Bit
Fluent Bit is a specialized open-source data collector tool for embedded operating systems and is developed by Treasure Data. Fluent Bit can be used as a standalone tool and can also be embedded in your C or C++ applications.
By embedding Fluent Bit in your C/C++ applications, you can have robust and light-weight data collection mechanism (buffering, retry, etc) inside your applications.
Embeding Fluent Bit and Connecting to Treasure Data
Get your Treasure Data API Key
Retrieve your Write-Only API key from here.
Prepare Configuration File
Prepare your configuration file by specifying: your TD Write-Only API key, the destination database, and table name. An example configuration is available here.
Embed fluent-bit into your Applications
Retrieve the entire source code from GitHub.
When Fluent Bit is built, it creates the final binary and a shared library version called libfluent-bit.so which can be linked in your projects. The library allows you to enqueue data into the engine and return quickly. All the hard work is done in one posix thread that works in an asynchronous mode. Your caller process or thread will not be blocked.
Here’s an example program to send the data to Treasure Data.
You only need to include the
fluent-bit.h header and use the functions in the right order. The description of each function is available here:
More information is available in the following links: