Skip to content

Commit 4d6620a

Browse files
committed
output documentation: Add examples of FLBRegisterPluginWithEventType
This change adds to the README.md files of each example output plugin and example of how to enable metric usage using the new function `FLBRegisterPluginWithEventType` Signed-off-by: jmccormick7 <[email protected]>
1 parent 155662a commit 4d6620a

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

examples/out_gstdout/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,18 @@ func FLBPluginRegister(ctx unsafe.Pointer) int {
2424

2525
This function is invoked at start time _before_ any configuration is done inside the engine.
2626

27+
### Setting event type
28+
29+
By default, Fluent Bit Golang plugins process logs. Optionally, the event_type
30+
can be set to allow for metrics by using `output.FLBPluginRegisterWithEventType`.
31+
32+
```go
33+
//export FLBPluginRegister
34+
func FLBPluginRegister(def unsafe.Pointer) int {
35+
return output.FLBPluginRegisterWithEventType(ctx, output.FLB_OUTPUT_METRICS, "gstdout", "Stdout GO!")
36+
}
37+
```
38+
2739
## Plugin Initialization
2840

2941
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:

examples/out_multiinstance/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,18 @@ func FLBPluginRegister(def unsafe.Pointer) int {
2929
This function is invoked at start time _before_ any configuration is done
3030
inside the engine.
3131

32+
### Setting event type
33+
34+
By default, Fluent Bit Golang plugins process logs. Optionally, the event_type
35+
can be set to allow for metrics by using `output.FLBPluginRegisterWithEventType`.
36+
37+
```go
38+
//export FLBPluginRegister
39+
func FLBPluginRegister(def unsafe.Pointer) int {
40+
return output.FLBPluginRegisterWithEventType(ctx, output.FLB_OUTPUT_METRICS, "multiinstance", "Testing multiple instances")
41+
}
42+
```
43+
3244
## Plugin Initialization
3345

3446
Before the engine starts, it initializes all plugins that were configured.

0 commit comments

Comments
 (0)