Skip to content

Commit 46284df

Browse files
edsipergitbook-bot
authored andcommitted
GitBook: [1.4-dev] 10 pages modified
1 parent fd25206 commit 46284df

File tree

10 files changed

+272
-117
lines changed

10 files changed

+272
-117
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
description: Next generation Log and Stream processor
2+
description: High Performance Logs Processor
33
---
44

55
# Fluent Bit v1.4 Documentation

SUMMARY.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
* [Disk I/O Metrics](pipeline/inputs/disk-io-metrics.md)
6666
* [Dummy](pipeline/inputs/dummy.md)
6767
* [Exec](pipeline/inputs/exec.md)
68-
* [Forward](pipeline/outputs/forward.md)
68+
* [Forward](pipeline/inputs/forward.md)
6969
* [Head](pipeline/inputs/head.md)
7070
* [Health](pipeline/inputs/health.md)
7171
* [Kernel Logs](pipeline/inputs/kernel-logs.md)
@@ -96,7 +96,7 @@
9696
* [Parser](pipeline/filters/parser.md)
9797
* [Record Modifier](pipeline/filters/record-modifier.md)
9898
* [Rewrite Tag](pipeline/filters/rewrite-tag.md)
99-
* [Standard Output](pipeline/outputs/standard-output.md)
99+
* [Standard Output](pipeline/filters/standard-output.md)
100100
* [Throttle](pipeline/filters/throttle.md)
101101
* [Nest](pipeline/filters/nest.md)
102102
* [Modify](pipeline/filters/modify.md)
@@ -138,3 +138,4 @@
138138
* [Ingest Records Manually](development/ingest-records-manually.md)
139139
* [Golang Output Plugins](development/golang-output-plugins.md)
140140
* [Developer guide for beginners on contributing to Fluent Bit](development/developer-guide.md)
141+

development/developer-guide.md

Lines changed: 42 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
1-
## Beginners Guide to Contributing to Fluent Bit
1+
# Developer guide for beginners on contributing to Fluent Bit
22

3-
Assuming you have some basic knowledge of C, this guide should help you understand how to make code
4-
changes to Fluent Bit.
3+
Assuming you have some basic knowledge of C, this guide should help you understand how to make code changes to Fluent Bit.
54

6-
### Libraries
5+
## Libraries
76

8-
Most external libraries are embedded in the project in the [/lib](/lib) folder. To keep its footprint low and make cross-platform builds simple, Fluent Bit attempts keep its dependency graph small.
7+
Most external libraries are embedded in the project in the [/lib](https://github.com/fluent/fluent-bit-docs/tree/3304eeed3122ab98a20fc4344ba573b00f698515/lib/README.md) folder. To keep its footprint low and make cross-platform builds simple, Fluent Bit attempts keep its dependency graph small.
98

109
The external library you are mostly likely to interact with is [msgpack](https://github.com/msgpack/msgpack-c).
1110

1211
For crypto, Fluent Bit uses [mbedtls](https://github.com/ARMmbed/mbedtls).
1312

14-
#### Memory Management
13+
### Memory Management
1514

1615
When you write Fluent Bit code, you will use Fluent Bit's versions of the standard C functions for working with memory:
17-
- [`flb_malloc()`](include/fluent-bit/flb_mem.h) - equivalent to `malloc`, allocates memory.
18-
- [`flb_calloc()`](include/fluent-bit/flb_mem.h) - equivalent to `calloc`, allocates memory and initializes it to zero.
19-
- [`flb_realloc()`](include/fluent-bit/flb_mem.h) - equivalent to `realloc`.
20-
- [`flb_free()`](include/fluent-bit/flb_mem.h) - equivalent to `free`, releases allocated memory.
2116

22-
Note that many types have a specialized create and destroy function. For example,
23-
[`flb_sds_create()` and `flb_sds_destroy()`](include/fluent-bit/flb_sds.h) (more about this in the next section).
17+
* [`flb_malloc()`](https://github.com/fluent/fluent-bit-docs/tree/3304eeed3122ab98a20fc4344ba573b00f698515/development/include/fluent-bit/flb_mem.h) - equivalent to `malloc`, allocates memory.
18+
* [`flb_calloc()`](https://github.com/fluent/fluent-bit-docs/tree/3304eeed3122ab98a20fc4344ba573b00f698515/development/include/fluent-bit/flb_mem.h) - equivalent to `calloc`, allocates memory and initializes it to zero.
19+
* [`flb_realloc()`](https://github.com/fluent/fluent-bit-docs/tree/3304eeed3122ab98a20fc4344ba573b00f698515/development/include/fluent-bit/flb_mem.h) - equivalent to `realloc`.
20+
* [`flb_free()`](https://github.com/fluent/fluent-bit-docs/tree/3304eeed3122ab98a20fc4344ba573b00f698515/development/include/fluent-bit/flb_mem.h) - equivalent to `free`, releases allocated memory.
2421

25-
#### Strings
22+
Note that many types have a specialized create and destroy function. For example, [`flb_sds_create()` and `flb_sds_destroy()`](https://github.com/fluent/fluent-bit-docs/tree/3304eeed3122ab98a20fc4344ba573b00f698515/development/include/fluent-bit/flb_sds.h) \(more about this in the next section\).
2623

27-
Fluent Bit has a stripped down version of the popular [SDS](https://github.com/antirez/sds) string library. See [flb_sds.h](include/fluent-bit/flb_sds.h) for the API.
24+
### Strings
25+
26+
Fluent Bit has a stripped down version of the popular [SDS](https://github.com/antirez/sds) string library. See [flb\_sds.h](https://github.com/fluent/fluent-bit-docs/tree/3304eeed3122ab98a20fc4344ba573b00f698515/development/include/fluent-bit/flb_sds.h) for the API.
2827

2928
In general, you should use SDS strings in any string processing code. SDS strings are fully compatible with any C function that accepts a null-terminated sequence of characters; to understand how they work, see the [explanation on Github](https://github.com/antirez/sds#how-sds-strings-work).
3029

31-
#### HTTP Client
30+
### HTTP Client
3231

3332
Fluent Bit has its own network connection library. The key types and functions are defined in the following header files:
34-
- [flb_upstream.h](include/fluent-bit/flb_upstream.h)
35-
- [flb_http_client.h](include/fluent-bit/flb_http_client.h)
36-
- [flb_io.h](include/fluent-bit/flb_io.h)
33+
34+
* [flb\_upstream.h](https://github.com/fluent/fluent-bit-docs/tree/3304eeed3122ab98a20fc4344ba573b00f698515/development/include/fluent-bit/flb_upstream.h)
35+
* [flb\_http\_client.h](https://github.com/fluent/fluent-bit-docs/tree/3304eeed3122ab98a20fc4344ba573b00f698515/development/include/fluent-bit/flb_http_client.h)
36+
* [flb\_io.h](https://github.com/fluent/fluent-bit-docs/tree/3304eeed3122ab98a20fc4344ba573b00f698515/development/include/fluent-bit/flb_io.h)
3737

3838
The following code demonstrates making an HTTP request in Fluent Bit:
3939

@@ -86,7 +86,7 @@ static flb_sds_t make_request(struct flb_config *config)
8686
}
8787

8888
/* Perform the HTTP request */
89-
ret = flb_http_do(client, &b_sent)
89+
ret = flb_http_do(client, &b_sent)
9090

9191
/* Validate return status and HTTP status if set */
9292
if (ret != 0 || client->resp.status != 200) {
@@ -114,11 +114,11 @@ static flb_sds_t make_request(struct flb_config *config)
114114
115115
An `flb_upstream` structure represents a host/endpoint that you want to call. Normally, you'd store this structure somewhere so that it can be re-used. An `flb_upstream_conn` represents a connection to that host for a single HTTP request. The connection structure should not be used for more than one request.
116116
117-
#### Linked Lists
117+
### Linked Lists
118118
119-
Fluent Bit contains a library for constructing linked lists- [mk_list](lib/monkey/include/monkey/mk_core/mk_list.h). The type stores data as a circular linked list.
119+
Fluent Bit contains a library for constructing linked lists- [mk\_list](https://github.com/fluent/fluent-bit-docs/tree/3304eeed3122ab98a20fc4344ba573b00f698515/development/lib/monkey/include/monkey/mk_core/mk_list.h). The type stores data as a circular linked list.
120120
121-
The [`mk_list.h`](lib/monkey/include/monkey/mk_core/mk_list.h) header file contains several macros and functions for use with the lists. The example below shows how to create a list, iterate through it, and delete an element.
121+
The [`mk_list.h`](https://github.com/fluent/fluent-bit-docs/tree/3304eeed3122ab98a20fc4344ba573b00f698515/development/lib/monkey/include/monkey/mk_core/mk_list.h) header file contains several macros and functions for use with the lists. The example below shows how to create a list, iterate through it, and delete an element.
122122
123123
```c
124124
#include <monkey/mk_core/mk_list.h>
@@ -173,11 +173,11 @@ static int example()
173173
}
174174
```
175175

176-
#### Message Pack
176+
### Message Pack
177177

178178
Fluent Bit uses [msgpack](https://msgpack.org/index.html) to internally store data. If you write code for Fluent Bit, it is almost certain that you will interact with msgpack.
179179

180-
Fluent Bit embeds the [msgpack-c](https://github.com/msgpack/msgpack-c) library. The example below shows manipulating message pack to add a new key-value pair to a record. In Fluent Bit, the [filter_record_modifier](plugins/filter_record_modifier) plugin adds or deletes keys from records. See its code for more.
180+
Fluent Bit embeds the [msgpack-c](https://github.com/msgpack/msgpack-c) library. The example below shows manipulating message pack to add a new key-value pair to a record. In Fluent Bit, the [filter\_record\_modifier](https://github.com/fluent/fluent-bit-docs/tree/3304eeed3122ab98a20fc4344ba573b00f698515/development/plugins/filter_record_modifier/README.md) plugin adds or deletes keys from records. See its code for more.
181181

182182
```c
183183
#define A_NEW_KEY "key"
@@ -263,21 +263,21 @@ static int cb_filter(const void *data, size_t bytes,
263263
264264
Please also check out the message pack examples on the [msgpack-c GitHub repo](https://github.com/msgpack/msgpack-c).
265265
266-
### Plugin API
266+
## Plugin API
267267
268268
Each plugin is a shared object which is [loaded into Fluent Bit](https://github.com/fluent/fluent-bit/blob/1.3/src/flb_plugin.c#L70) using dlopen and dlsym.
269269
270-
#### Input
270+
### Input
271271
272-
The input plugin structure is defined in [flb_input.h](https://github.com/fluent/fluent-bit/blob/master/include/fluent-bit/flb_input.h#L62). There are a number of functions which a plugin can implement, most only implement `cb_init`, `cb_collect`, and `cb_exit`.
272+
The input plugin structure is defined in [flb\_input.h](https://github.com/fluent/fluent-bit/blob/master/include/fluent-bit/flb_input.h#L62). There are a number of functions which a plugin can implement, most only implement `cb_init`, `cb_collect`, and `cb_exit`.
273273
274-
The [`"dummy"` input plugin](plugins/in_dummy) very simple and is an excellent example to review to understand more.
274+
The [`"dummy"` input plugin](https://github.com/fluent/fluent-bit-docs/tree/3304eeed3122ab98a20fc4344ba573b00f698515/development/plugins/in_dummy/README.md) very simple and is an excellent example to review to understand more.
275275
276-
#### Filter
276+
### Filter
277277
278-
The structure for filter plugins is defined in [flb_filter.h](https://github.com/fluent/fluent-bit/blob/master/include/fluent-bit/flb_filter.h#L44). Each plugin must implement `cb_init`, `cb_filter`, and `cb_exit`.
278+
The structure for filter plugins is defined in [flb\_filter.h](https://github.com/fluent/fluent-bit/blob/master/include/fluent-bit/flb_filter.h#L44). Each plugin must implement `cb_init`, `cb_filter`, and `cb_exit`.
279279
280-
The [filter_record_modifier](plugins/filter_record_modifier) is a good example of a filter plugin.
280+
The [filter\_record\_modifier](https://github.com/fluent/fluent-bit-docs/tree/3304eeed3122ab98a20fc4344ba573b00f698515/development/plugins/filter_record_modifier/README.md) is a good example of a filter plugin.
281281
282282
Note that filter plugins can not asynchronously make HTTP requests. If your plugin needs to make a request, add the following code when you initialize your `flb_upstream`:
283283
@@ -286,25 +286,27 @@ Note that filter plugins can not asynchronously make HTTP requests. If your plug
286286
upstream->flags &= ~(FLB_IO_ASYNC);
287287
```
288288

289-
#### Output
289+
### Output
290290

291-
Output plugins are defined in [flb_output.h](https://github.com/fluent/fluent-bit/blob/master/include/fluent-bit/flb_output.h#L57). Each plugin must implement `cb_init`, `cb_flush`, and `cb_exit`.
291+
Output plugins are defined in [flb\_output.h](https://github.com/fluent/fluent-bit/blob/master/include/fluent-bit/flb_output.h#L57). Each plugin must implement `cb_init`, `cb_flush`, and `cb_exit`.
292292

293-
The [stdout plugin](plugins/out_stdout) is very simple; review its code to understand how output plugins work.
293+
The [stdout plugin](https://github.com/fluent/fluent-bit-docs/tree/3304eeed3122ab98a20fc4344ba573b00f698515/development/plugins/out_stdout/README.md) is very simple; review its code to understand how output plugins work.
294294

295-
### Testing
295+
## Testing
296296

297297
During development, you can build Fluent Bit as follows:
298298

299-
```
299+
```text
300300
cd build
301301
cmake -DFLB_DEV=On ../
302302
make
303303
```
304+
304305
Note that Fluent Bit uses Cmake 3 and on some systems you may need to invoke it as `cmake3`.
305306

306307
To enable the unit tests run:
307-
```
308+
309+
```text
308310
cmake -DFLB_DEV=On -DFLB_TESTS_RUNTIME=On -DFLB_TESTS_INTERNAL=On ../
309311
make
310312
```
@@ -313,13 +315,14 @@ Internal tests are for the internal libraries of Fluent Bit. Runtime tests are f
313315

314316
You can run the unit tests with `make test`, however, this is inconvenient in practice. Each test file will create an executable in the `build/bin` directory which you can run directly. For example, if you want to run the SDS tests, you can invoke them as follows:
315317

316-
```
318+
```text
317319
$ ./bin/flb-it-sds
318320
Test sds_usage... [ OK ]
319321
Test sds_printf... [ OK ]
320322
SUCCESS: All unit tests have passed.
321323
```
322324

323-
### Need more help?
325+
## Need more help?
324326

325327
The best way to learn how Fluent Bit code works is to read it. If you need help understanding the code, reach out to the community, or open a PR with changes that are a work in progress.
328+

installation/linux/amazon-linux.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
Fluent Bit is distributed as **td-agent-bit** package and is available for the latest Amazon Linux 2. The following architectures are supported
66

7-
- x86_64
8-
- aarch64 / arm64v8
7+
* x86\_64
8+
* aarch64 / arm64v8
99

1010
## Configure Yum
1111

installation/linux/raspbian-raspberry-pi.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
Fluent Bit is distributed as **td-agent-bit** package and is available for the Raspberry, specifically for [Raspbian](http://raspbian.org) distribution, the following versions are supported:
44

5-
- Raspbian 10
6-
- Raspbian 9
7-
- Raspbian 8
5+
* Raspbian 10
6+
* Raspbian 9
7+
* Raspbian 8
88

99
## Server GPG key
1010

installation/linux/redhat-centos.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
Fluent Bit is distributed as **td-agent-bit** package and is available for the latest stable CentOS system. The following architectures are supported
66

7-
- x86_64
8-
- aarch64 / arm64v8
7+
* x86\_64
8+
* aarch64 / arm64v8
99

1010
## Configure Yum
1111

installation/supported-platforms.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ The following operating systems and architectures are supported in Fluent Bit.
77
| Linux | [Amazon Linux 2](linux/amazon-linux.md) | x86\_64, Arm64v8 |
88
| | [Centos 8](linux/redhat-centos.md) | x86\_64, Arm64v8 |
99
| | [Centos 7](linux/redhat-centos.md) | x86\_64, Arm64v8 |
10-
| | [Debian 10 (Buster)](linux/debian.md) | x86\_64, Arm64v8 |
10+
| | [Debian 10 \(Buster\)](linux/debian.md) | x86\_64, Arm64v8 |
1111
| | [Debian 9 \(Stretch\)](linux/debian.md) | x86\_64, Arm64v8 |
12-
| | [Debian 8 \(Jessie\)](linux/debian.md) | x86\_64, Arm64v8 |
13-
| | [Ubuntu 18.04 \(Bionic Beaver\)](linux/ubuntu.md) | x86_64 |
14-
| | [Ubuntu 16.04 \(Xenial Xerus\)](linux/ubuntu.md) | x86\_64 |
12+
| | [Debian 8 \(Jessie\)](linux/debian.md) | x86\_64, Arm64v8 |
13+
| | [Ubuntu 18.04 \(Bionic Beaver\)](linux/ubuntu.md) | x86\_64 |
14+
| | [Ubuntu 16.04 \(Xenial Xerus\)](linux/ubuntu.md) | x86\_64 |
1515
| | [Raspbian 10 \(Buster\)](linux/raspbian-raspberry-pi.md) | Arm32v7 |
1616
| | [Raspbian 9 \(Stretch\)](linux/raspbian-raspberry-pi.md) | Arm32v7 |
1717
| | [Raspbian 8 \(Jessie\)](linux/raspbian-raspberry-pi.md) | Arm32v7 |

pipeline/filters/standard-output.md

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,34 @@
11
# Standard Output
22

3-
The _Standard Output Filter_ plugin allows to print to the standard output the data received through the _input_ plugin.
3+
The **stdout** output plugin allows to print to the standard output the data received through the _input_ plugin. Their usage is very simple as follows:
44

55
## Configuration Parameters
66

7-
There are no parameters.
8-
9-
## Getting Started
10-
11-
In order to start filtering records, you can run the filter from the command line or through the configuration file.
7+
| Key | Description | default |
8+
| :--- | :--- | :--- |
9+
| Format | Specify the data format to be printed. Supported formats are _msgpack_ _json_, _json\_lines_ and _json\_stream_. | msgpack |
10+
| json\_date\_key | Specify the name of the date field in output | date |
11+
| json\_date\_format | Specify the format of the date. Supported formats are _double_, _iso8601_ \(eg: _2018-05-30T09:39:52.000681Z_\) and _epoch_. | double |
1212

1313
### Command Line
1414

15-
```text
16-
$ fluent-bit -i cpu -t cpu.local -F stdout -m '*' -o null -m '*'
15+
```bash
16+
$ bin/fluent-bit -i cpu -o stdout -v
1717
```
1818

19-
### Configuration File
20-
21-
In your main configuration file append the following _FILTER_ sections:
19+
We have specified to gather [CPU](https://github.com/fluent/fluent-bit-docs/tree/ddc1cf3d996966b9db39f8784596c8b7132b4d5b/pipeline/input/cpu.md) usage metrics and print them out to the standard output in a human readable way:
2220

23-
```python
24-
[INPUT]
25-
Name cpu
26-
Tag cpu.local
21+
```bash
22+
$ bin/fluent-bit -i cpu -o stdout -p format=msgpack -v
23+
Fluent-Bit v1.2.x
24+
Copyright (C) Treasure Data
2725

28-
[FILTER]
29-
Name stdout
30-
Match *
31-
32-
[OUTPUT]
33-
Name null
34-
Match *
26+
[2016/10/07 21:52:01] [ info] [engine] started
27+
[0] cpu.0: [1475898721, {"cpu_p"=>0.500000, "user_p"=>0.250000, "system_p"=>0.250000, "cpu0.p_cpu"=>0.000000, "cpu0.p_user"=>0.000000, "cpu0.p_system"=>0.000000, "cpu1.p_cpu"=>0.000000, "cpu1.p_user"=>0.000000, "cpu1.p_system"=>0.000000, "cpu2.p_cpu"=>0.000000, "cpu2.p_user"=>0.000000, "cpu2.p_system"=>0.000000, "cpu3.p_cpu"=>1.000000, "cpu3.p_user"=>0.000000, "cpu3.p_system"=>1.000000}]
28+
[1] cpu.0: [1475898722, {"cpu_p"=>0.250000, "user_p"=>0.250000, "system_p"=>0.000000, "cpu0.p_cpu"=>0.000000, "cpu0.p_user"=>0.000000, "cpu0.p_system"=>0.000000, "cpu1.p_cpu"=>1.000000, "cpu1.p_user"=>1.000000, "cpu1.p_system"=>0.000000, "cpu2.p_cpu"=>0.000000, "cpu2.p_user"=>0.000000, "cpu2.p_system"=>0.000000, "cpu3.p_cpu"=>0.000000, "cpu3.p_user"=>0.000000, "cpu3.p_system"=>0.000000}]
29+
[2] cpu.0: [1475898723, {"cpu_p"=>0.750000, "user_p"=>0.250000, "system_p"=>0.500000, "cpu0.p_cpu"=>2.000000, "cpu0.p_user"=>1.000000, "cpu0.p_system"=>1.000000, "cpu1.p_cpu"=>0.000000, "cpu1.p_user"=>0.000000, "cpu1.p_system"=>0.000000, "cpu2.p_cpu"=>1.000000, "cpu2.p_user"=>0.000000, "cpu2.p_system"=>1.000000, "cpu3.p_cpu"=>0.000000, "cpu3.p_user"=>0.000000, "cpu3.p_system"=>0.000000}]
30+
[3] cpu.0: [1475898724, {"cpu_p"=>1.000000, "user_p"=>0.750000, "system_p"=>0.250000, "cpu0.p_cpu"=>1.000000, "cpu0.p_user"=>1.000000, "cpu0.p_system"=>0.000000, "cpu1.p_cpu"=>2.000000, "cpu1.p_user"=>1.000000, "cpu1.p_system"=>1.000000, "cpu2.p_cpu"=>1.000000, "cpu2.p_user"=>1.000000, "cpu2.p_system"=>0.000000, "cpu3.p_cpu"=>1.000000, "cpu3.p_user"=>1.000000, "cpu3.p_system"=>0.000000}]
3531
```
3632

33+
No more, no less, it just works.
34+

0 commit comments

Comments
 (0)