From e82f4a8fa9bf0cd452d8dc5245ddbc851cd2f9c4 Mon Sep 17 00:00:00 2001 From: Takahiro YAMASHITA Date: Thu, 1 Sep 2016 22:09:48 +0900 Subject: [PATCH] api: add new API flb_service_set() Signed-off-by: Takahiro YAMASHITA --- development/library_api.md | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/development/library_api.md b/development/library_api.md index 8d1dfbbd9..1bf82c353 100644 --- a/development/library_api.md +++ b/development/library_api.md @@ -6,7 +6,7 @@ [Fluent Bit](http://fluentbit.io) runs as a service, meaning that the API exposed for developers provide interfaces to create and manage a context, specify inputs/outputs, set configuration parameters and set routing paths for the event/records. A typical usage of the library involves: -- Create library instance/context. +- Create library instance/context and set properties. - Enable _input_ plugin(s) instances and set properties. - Enable _output_ plugin(s) instances and set properties. - Start the library runtime. @@ -53,6 +53,34 @@ if (!ctx) { } ``` +### Set Service Properties + +Using the __flb_service_set()__ function is possible to set context properties. + +__Prototype__ + +```C +int flb_service_set(flb_ctx_t *ctx, ...); +``` + +__Return Value__ + +On success it returns 0; on error it returns a negative number. + +__Usage__ + +The __flb_service_set()__ allows to set one or more properties in a key/value string mode, e.g: + +```C +int ret; + +ret = flb_service_set(ctx, "Flush", "1", NULL); + +``` + +The above example specified the values for the properties __Flush__ , note that the value is always a string (char *) and once there is no more parameters a NULL argument must be added at the end of the list. + + ### Enable Input Plugin Instance When built, [Fluent Bit](http://fluentbit.io) library contains a certain number of built-in _input_ plugins. In order to enable an _input_ plugin, the function __flb_input__() is used to create an instance of it. @@ -97,7 +125,7 @@ On success it returns 0; on error it returns a negative number. __Usage__ -The __flb_input_set()__ allow to set one or more properties in a key/value string mode, e.g: +The __flb_input_set()__ allows to set one or more properties in a key/value string mode, e.g: ```C int ret; @@ -156,7 +184,7 @@ On success it returns 0; on error it returns a negative number. __Usage__ -The __flb_output_set()__ allow to set one or more properties in a key/value string mode, e.g: +The __flb_output_set()__ allows to set one or more properties in a key/value string mode, e.g: ```C int ret;