Skip to content

Commit 147fe08

Browse files
committed
Dev: golang: Style updates
Signed-off-by: Lynette Miles <lynette.miles@chronosphere.io>
1 parent ddfbbcc commit 147fe08

File tree

1 file changed

+60
-30
lines changed

1 file changed

+60
-30
lines changed

development/golang-output-plugins.md

Lines changed: 60 additions & 30 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,19 @@ 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
82+
final `.so` file is as expected. When you use the `ldd` over the library should see
83+
something similar to this:
8284

83-
```text
85+
```shell
8486
$ ldd out_gstdout.so
8587
linux-vdso.so.1 => (0x00007fff561dd000)
8688
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fc4aeef0000)
@@ -91,23 +93,23 @@ $ ldd out_gstdout.so
9193
## Run Fluent Bit with the new plugin
9294

9395
```bash
94-
$ bin/fluent-bit -e /path/to/out_gstdout.so -i cpu -o gstdout
96+
bin/fluent-bit -e /path/to/out_gstdout.so -i cpu -o gstdout
9597
```
9698

9799
## Configuration file
98100

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

101103
- Plugins configuration file
102104
- [Main configuration file](../administration/configuring-fluent-bit/classic-mode/configuration-file.md)
103105

104106
### Plugins configuration file
105107

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

110-
#### Example
112+
#### Plugin file example
111113

112114
```python
113115
[PLUGINS]
@@ -118,11 +120,11 @@ Fluent Bit can load / run Golang plugin using two configuration file.
118120

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

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). | |
123+
| Key | Description |
124+
| ---- | ----------- |
125+
| `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). |
124126

125-
#### Example
127+
#### Main configuration file example
126128

127129
The following is an example of a main configuration file.
128130

@@ -139,13 +141,41 @@ The following is an example of a main configuration file.
139141

140142
#### Config key constraint
141143

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

144174
### Run using a configuration file
145175

146-
We can load a main configuration file using `-c` option.
176+
You can load a main configuration file using `-c` option.
147177
Note: No need to specify a plugins configuration file from command line.
148178

149179
```text
150180
fluent-bit -c fluent-bit.conf
151-
```
181+
```

0 commit comments

Comments
 (0)