Skip to content

Commit e82f4a8

Browse files
committed
api: add new API flb_service_set()
Signed-off-by: Takahiro YAMASHITA <nokute78@gmail.com>
1 parent fbe21d1 commit e82f4a8

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

development/library_api.md

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
[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:
88

9-
- Create library instance/context.
9+
- Create library instance/context and set properties.
1010
- Enable _input_ plugin(s) instances and set properties.
1111
- Enable _output_ plugin(s) instances and set properties.
1212
- Start the library runtime.
@@ -53,6 +53,34 @@ if (!ctx) {
5353
}
5454
```
5555

56+
### Set Service Properties
57+
58+
Using the __flb_service_set()__ function is possible to set context properties.
59+
60+
__Prototype__
61+
62+
```C
63+
int flb_service_set(flb_ctx_t *ctx, ...);
64+
```
65+
66+
__Return Value__
67+
68+
On success it returns 0; on error it returns a negative number.
69+
70+
__Usage__
71+
72+
The __flb_service_set()__ allows to set one or more properties in a key/value string mode, e.g:
73+
74+
```C
75+
int ret;
76+
77+
ret = flb_service_set(ctx, "Flush", "1", NULL);
78+
79+
```
80+
81+
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.
82+
83+
5684
### Enable Input Plugin Instance
5785

5886
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.
97125
98126
__Usage__
99127
100-
The __flb_input_set()__ allow to set one or more properties in a key/value string mode, e.g:
128+
The __flb_input_set()__ allows to set one or more properties in a key/value string mode, e.g:
101129
102130
```C
103131
int ret;
@@ -156,7 +184,7 @@ On success it returns 0; on error it returns a negative number.
156184
157185
__Usage__
158186
159-
The __flb_output_set()__ allow to set one or more properties in a key/value string mode, e.g:
187+
The __flb_output_set()__ allows to set one or more properties in a key/value string mode, e.g:
160188
161189
```C
162190
int ret;

0 commit comments

Comments
 (0)