You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+7-1Lines changed: 7 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,12 @@
2
2
3
3
This repository contains Go packages that allows to create [Fluent Bit](http://fluentbit.io) plugins. At the moment it only supports the creation of _Output_ plugins.
4
4
5
+
## Requirements
6
+
7
+
The code of this package is intended to be used with [Fluent Bit 0.12](https://github.com/fluent/fluent-bit/tree/0.12) branch.
8
+
9
+
> Fluent Bit on GIT master (0.12) uses a different format to set records timestamps, this package is not backward compatible with Fluent Bit 0.11
10
+
5
11
## Usage
6
12
7
13
Fluent Bit Go packages are exposed on this repository:
When Fluent Bit loads a Golang plugin, it lookup and load the registration callback that aims to populate the internal structure with plugin name and description among others:
This function is invoked at start time _before_ any configuration is done inside the engine.
26
+
27
+
## Plugin Initialization
28
+
29
+
Before the engine starts, it initialize all plugins that were requested to start. Upon initialization a configuration context already exists, so the plugin can ask for configuration parameters or do any other internal checks. E.g:
30
+
31
+
```go
32
+
//export FLBPluginInit
33
+
funcFLBPluginInit(ctxunsafe.Pointer) int {
34
+
return output.FLB_OK
35
+
}
36
+
```
37
+
38
+
The function must return FLB\_OK when it initialized properly or FLB\_ERROR if something went wrong. If the plugin reports an error, the engine will _not_ load the instance.
39
+
40
+
## Runtime Flush
41
+
42
+
Upon flush time, when Fluent Bit want's to flush it buffers, the runtime flush callback will be triggered.
43
+
44
+
The callback will receive a raw buffer of msgpack data with it proper bytes length and the tag associated.
45
+
46
+
```go
47
+
//export FLBPluginFlush
48
+
funcFLBPluginFlush(dataunsafe.Pointer, lengthC.int, tag *C.char) int {
49
+
return output.FLB_OK
50
+
}
51
+
```
52
+
53
+
> for more details about how to process the incoming msgpack data, refer to the [out_gstdout.go](out_gstdout.go) file.
54
+
55
+
When done, there are three returning values available:
0 commit comments