Skip to content

Commit 5c43896

Browse files
authored
Merge pull request #1672 from fluent/lynettemiles/sc-123164/update-development-golang-output-plugins
2 parents 6716bb1 + 5395fc6 commit 5c43896

File tree

1 file changed

+58
-31
lines changed

1 file changed

+58
-31
lines changed

development/golang-output-plugins.md

Lines changed: 58 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
# Golang Output Plugins
1+
# Golang output plugins
22

3-
Fluent Bit currently supports integration of Golang plugins built as shared objects for output plugins only. The interface for the Golang plugins is currently under development but is functional.
3+
Fluent Bit supports integration of Golang plugins built as shared objects for output plugins only. The interface for the Golang plugins is currently under development but is functional.
44

5-
## Getting Started
5+
## Get started
66

7-
Compile Fluent Bit with Golang support, e.g:
7+
Compile Fluent Bit with Golang support:
88

9-
```text
10-
$ cd build/
11-
$ cmake -DFLB_DEBUG=On -DFLB_PROXY_GO=On ../
12-
$ make
9+
```shell
10+
cd build/
11+
cmake -DFLB_DEBUG=On -DFLB_PROXY_GO=On ../
12+
make
1313
```
1414

15-
Once compiled, we can see a new option in the binary `-e` which stands for _external plugin_, e.g:
15+
Once compiled, you can see the new `-e` option in the binary which stands for _external plugin_.
1616

1717
```text
1818
$ bin/fluent-bit -h
@@ -30,13 +30,13 @@ Available Options
3030
...
3131
```
3232

33-
## Build a Go Plugin
33+
## Build a Go plugin
3434

35-
The _fluent-bit-go_ package is available to assist developers in creating Go plugins.
35+
The `fluent-bit-go` package is available to assist developers in creating Go plugins.
3636

3737
[https://github.com/fluent/fluent-bit-go](https://github.com/fluent/fluent-bit-go)
3838

39-
At a minimum, a Go plugin looks like this:
39+
A minimum Go plugin looks like the following:
4040

4141
```go
4242
package main
@@ -70,17 +70,17 @@ func main() {
7070
}
7171
```
7272

73-
the code above is a template to write an output plugin, it's really important to keep the package name as `main` and add an explicit `main()` function. This is a requirement as the code will be build as a shared library.
73+
The previous code is a template to write an output plugin. It's important to keep the package name as `main` and add an explicit `main()` function. This is a requirement as the code will be build as a shared library.
7474

75-
To build the code above, use the following line:
75+
To build the code, use the following line:
7676

7777
```bash
78-
$ go build -buildmode=c-shared -o out_gstdout.so out_gstdout.go
78+
go build -buildmode=c-shared -o out_gstdout.so out_gstdout.go
7979
```
8080

81-
Once built, a shared library called `out\_gstdout.so` will be available. It's really important to double check the final .so file is what we expect. Doing a `ldd` over the library we should see something similar to this:
81+
Once built, a shared library called `out_gstdout.so` will be available. Confirm the final `.so` file is as expected. When you use the `ldd` over the library should see something similar to this:
8282

83-
```text
83+
```shell
8484
$ ldd out_gstdout.so
8585
linux-vdso.so.1 => (0x00007fff561dd000)
8686
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fc4aeef0000)
@@ -91,23 +91,23 @@ $ ldd out_gstdout.so
9191
## Run Fluent Bit with the new plugin
9292

9393
```bash
94-
$ bin/fluent-bit -e /path/to/out_gstdout.so -i cpu -o gstdout
94+
bin/fluent-bit -e /path/to/out_gstdout.so -i cpu -o gstdout
9595
```
9696

9797
## Configuration file
9898

99-
Fluent Bit can load / run Golang plugin using two configuration file.
99+
Fluent Bit can load and run Golang plugins using two configuration files.
100100

101101
- Plugins configuration file
102102
- [Main configuration file](../administration/configuring-fluent-bit/classic-mode/configuration-file.md)
103103

104104
### Plugins configuration file
105105

106-
| Key | Description | Default Value|
107-
| ---- | ----------- | ------------ |
108-
| Path | A path for a Golang plugin. | |
106+
| Key | Description |
107+
| ---- | ----------- |
108+
| Path | A path for a Golang plugin. |
109109

110-
#### Example
110+
#### Plugin file example
111111

112112
```python
113113
[PLUGINS]
@@ -118,11 +118,11 @@ Fluent Bit can load / run Golang plugin using two configuration file.
118118

119119
The keys for Golang plugin available as of this version are described in the following table:
120120

121-
| Key | Description | Default Value|
122-
| ---- | ----------- | ------------ |
123-
| Plugins_file | Path for a plugins configuration file. A _plugins_ configuration file allows to define paths for external plugins, for an example [see here](https://github.com/fluent/fluent-bit/blob/master/conf/plugins.conf). | |
121+
| Key | Description |
122+
| ---- | ----------- |
123+
| `Plugins_file` | Path for a plugins configuration file. A plugins configuration file let you define paths for external plugins. For example, [see here](https://github.com/fluent/fluent-bit/blob/master/conf/plugins.conf). |
124124

125-
#### Example
125+
#### Main configuration file example
126126

127127
The following is an example of a main configuration file.
128128

@@ -139,13 +139,40 @@ The following is an example of a main configuration file.
139139

140140
#### Config key constraint
141141

142-
Some config keys are reserved by Fluent Bit and must not be used by a custom plugin, they are: `alias`,`host`,`ipv6`,`listen`,`log_level`,`log_suppress_interval`,`match`,`match_regex`,`mem_buf_limit`,`port`,`retry_limit`,`routable`,`storage.pause_on_chunks_overlimit`, `storage.total_limit_size`, `storage.type`, `tag`,`threaded`,`tls`,`tls.ca_file`, `tls.ca_path`, `tls.crt_file`, `tls.debug`, `tls.key_file`, `tls.key_passwd`, `tls.verify`, `tls.vhost`, `workers`
142+
The following configuration keys are reserved by Fluent Bit and must not be used by a custom plugin:
143+
144+
- `alias`
145+
- `host`
146+
- `ipv6`
147+
- `listen`
148+
- `log_level`
149+
- `log_suppress_interval`
150+
- `match`
151+
- `match_regex`
152+
- `mem_buf_limit`
153+
- `port`
154+
- `retry_limit`
155+
- `routable`
156+
- `storage.pause_on_chunks_overlimit`
157+
- `storage.total_limit_size`
158+
- `storage.type`
159+
- `tag`
160+
- `threaded`
161+
- `tls`
162+
- `tls.ca_file`
163+
- `tls.ca_path`
164+
- `tls.crt_file`
165+
- `tls.debug`
166+
- `tls.key_file`
167+
- `tls.key_passwd`
168+
- `tls.verify`
169+
- `tls.vhost`
170+
- `workers`
143171

144172
### Run using a configuration file
145173

146-
We can load a main configuration file using `-c` option.
147-
Note: No need to specify a plugins configuration file from command line.
174+
You can load a main configuration file using `-c` option. You don't need to specify a plugins configuration file from command line.
148175

149176
```text
150177
fluent-bit -c fluent-bit.conf
151-
```
178+
```

0 commit comments

Comments
 (0)