Skip to content

Commit ee5fb74

Browse files
committed
development: wasm final style
Signed-off-by: Lynette Miles <[email protected]>
1 parent 52da3dc commit ee5fb74

File tree

3 files changed

+37
-27
lines changed

3 files changed

+37
-27
lines changed

development/wasm-filter-plugins.md

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ There are no additional requirements to execute Wasm plugins.
1212

1313
#### Build `flb-wamrc` (optional)
1414

15-
`flb-wamrc` is a `flb`-prefixed AOT (ahead of time) compiler that's provided from [`wasm-micro-runtime`](https://github.com/bytecodealliance/wasm-micro-runtime).
15+
`flb-wamrc` is a `flb`-prefixed Ahead of Time (AOT) compiler that's provided from [`wasm-micro-runtime`](https://github.com/bytecodealliance/wasm-micro-runtime).
1616

1717
For `flb-wamrc` support, you must install the LLVM infrastructure and some additional libraries (`libmlir`, `libPolly`, `libedit`, and `libpfm`). For example:
1818

@@ -22,13 +22,13 @@ For `flb-wamrc` support, you must install the LLVM infrastructure and some addit
2222

2323
### For Wasm programs
2424

25-
Currently, Fluent Bit supports the following Wasm tool chains:
25+
Fluent Bit supports the following Wasm tool chains:
2626

27-
* Rust on `wasm32-unknown-unknown`
28-
* rustc 1.62.1 (e092d0b6b 2022-07-16) or later
29-
* [TinyGo](https://github.com/tinygo-org/tinygo) on `wasm32-wasi`
30-
* v0.24.0 or later
31-
* [WASI SDK](https://github.com/WebAssembly/wasi-sdk) 13 or later.
27+
- Rust on `wasm32-unknown-unknown`
28+
- rustc 1.62.1 (`e092d0b6b` 2022-07-16) or later
29+
- [TinyGo](https://github.com/tinygo-org/tinygo) on `wasm32-wasi`
30+
- v0.24.0 or later
31+
- [WASI SDK](https://github.com/WebAssembly/wasi-sdk) 13 or later.
3232

3333
## Get started
3434

@@ -44,8 +44,13 @@ To support AOT-compiled Wasm execution as filter plugins, build Fluent Bit with
4444

4545
Once compiled, you can see new plugins that handle `wasm`, for example:
4646

47+
```shell
48+
bin/fluent-bit -h
49+
```
50+
51+
Which returns results similar to:
52+
4753
```text
48-
$ bin/fluent-bit -h
4954
Usage: fluent-bit [OPTION]
5055
Inputs
5156
# ... other input plugin stuffs
@@ -60,9 +65,9 @@ Filters
6065

6166
The Fluent Bit Wasm filter assumes C ABI, also known as `wasm32-unknown-unknown` on Rust target and `wasm32-wasi` on TinyGo target.
6267

63-
### To Install Additional Components
68+
### Install additional components
6469

65-
TinyGo and WASI SDK support Wasm target by default. When using Rust's `wasm32-unknown-unknown` target, you must install `wasm32-unknown-unknown` by using [rustup](https://rustup.rs/). Then, install the target components as follows:
70+
TinyGo and WASI SDK support Wasm target by default. When using Rust's `wasm32-unknown-unknown` target, you must install `wasm32-unknown-unknown` by using [`rustup`](https://rustup.rs/). Then, install the target components as follows:
6671

6772
```text
6873
rustup target add wasm32-unknown-unknown
@@ -116,7 +121,7 @@ pipeline:
116121
function_name: super_awesome_filter
117122
# Note: run Fluent Bit from the 'wasm_path' location.
118123
accessible_paths: /path/to/fluent-bit
119-
124+
120125
outputs:
121126
- name: stdout
122127
match: '*'
@@ -152,7 +157,8 @@ For example, one of the sample [Rust Wasm filters](https://github.com/fluent/flu
152157
[0] dummy.local: [1666270589.270348000, {"lang"=>"Rust", "message"=>"dummy", "original"=>"{"message":"dummy"}", "tag"=>"dummy.local", "time"=>"2022-10-20T12:56:29.270348000 +0000"}]
153158
[0] dummy.local: [1666270590.271107000, {"lang"=>"Rust", "message"=>"dummy", "original"=>"{"message":"dummy"}", "tag"=>"dummy.local", "time"=>"2022-10-20T12:56:30.271107000 +0000"}]
154159
```
155-
Another example of a Rust Wasm filter is the [flb_filter_iis](https://github.com/kenriortega/flb_filter_iis) filter.
160+
161+
Another example of a Rust Wasm filter is the [`flb_filter_iis`](https://github.com/kenriortega/flb_filter_iis) filter.
156162

157163
This filter takes the [Internet Information Services (IIS)](https://learn.microsoft.com/en-us/iis/manage/provisioning-and-managing-iis/configure-logging-in-iis) [w3c logs](https://learn.microsoft.com/en-us/iis/manage/provisioning-and-managing-iis/configure-logging-in-iis#select-w3c-fields-to-log) (with some custom modifications) and transforms the raw string into a standard Fluent Bit JSON structured record.
158164

@@ -172,7 +178,7 @@ pipeline:
172178
wasm_path: /plugins/flb_filter_iis_wasm.wasm
173179
function_name: flb_filter_log_iis_w3c_custom
174180
accessible_paths: .
175-
181+
176182
outputs:
177183
- name: stdout
178184
match: 'iis.*'
@@ -213,6 +219,7 @@ The output after the filter logic will be:
213219
```
214220

215221
This filter approach offers several advantages inherent to programming languages. For example:
222+
216223
- It can be extended by adding type conversion to fields, such as `sc_bytes`, `cs_bytes`, and `time_taken`. You can use this to validate data results.
217224
- It allows for the use of conditions to apply more descriptive filters. For example, you can get only all logs that contain status codes higher than `4xx` or `5xx`.
218225
- It can be used to define allow lists and deny lists using a data structure array or a file to store predefined IP addresses.
@@ -254,6 +261,7 @@ AOT compiling should generate CPU architecture-dependent objects. If you want to
254261

255262
### Further examples
256263

257-
* [C filter](https://github.com/fluent/fluent-bit/tree/master/examples/filter_wasm_c)
258-
* [Rust Filter](https://github.com/fluent/fluent-bit/tree/master/examples/filter_rust)
259-
* [TinyGo filter](https://github.com/fluent/fluent-bit/tree/master/examples/filter_wasm_go)
264+
- [C filter](https://github.com/fluent/fluent-bit/tree/master/examples/filter_wasm_c)
265+
- [Rust Filter](https://github.com/fluent/fluent-bit/tree/master/examples/filter_rust)
266+
- [TinyGo
267+
filter](https://github.com/fluent/fluent-bit/tree/master/examples/filter_wasm_go)

development/wasm-input-plugins.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ There are no additional requirements to execute Wasm plugins.
1212

1313
### For Wasm programs
1414

15-
Fluent Bit supports the following Wasm toolchains:
15+
Fluent Bit supports the following Wasm tool chains:
1616

17-
* Rust on `wasm32-unknown-unknown`
18-
* rustc 1.62.1 (e092d0b6b 2022-07-16) or later
19-
* [TinyGo](https://github.com/tinygo-org/tinygo) on `wasm32-wasi`
20-
* v0.24.0 or later
21-
* [WASI SDK](https://github.com/WebAssembly/wasi-sdk) 13 or later
17+
- Rust on `wasm32-unknown-unknown`
18+
- rustc 1.62.1 (`e092d0b6b` 2022-07-16) or later
19+
- [TinyGo](https://github.com/tinygo-org/tinygo) on `wasm32-wasi`
20+
- v0.24.0 or later
21+
- [WASI SDK](https://github.com/WebAssembly/wasi-sdk) 13 or later
2222

2323
## Get started
2424

@@ -50,7 +50,7 @@ Wasm input in Fluent Bit assumes WASI ABI, also known as `wasm32-wasi` on Rust t
5050

5151
### Install additional components
5252

53-
TinyGo and WASI SDK support Wasm target by default. When using Rust's `wasm32-wasi` target, you must install `wasm32-wasi` by using [rustup](https://rustup.rs/). Then, install the target components as:
53+
TinyGo and WASI SDK support Wasm target by default. When using Rust's `wasm32-wasi` target, you must install `wasm32-wasi` by using [`rustup`](https://rustup.rs/). Then, install the target components as:
5454

5555
```text
5656
rustup target add wasm32-wasi
@@ -74,10 +74,10 @@ pipeline:
7474
tag: exec.wasi.local
7575
wasi_path: /path/to/wasi_built_json.wasm
7676
# For security reasons, WASM/WASI program cannot access its outer world
77-
# without accessible permissions. Uncomment below 'accessible_paths' and
77+
# without accessible permissions. Uncomment below 'accessible_paths' and
7878
# run Fluent Bit from the 'wasi_path' location:
7979
# accessible_paths /path/to/fluent-bit
80-
80+
8181
outputs:
8282
- name: stdout
8383
match: '*'
@@ -92,7 +92,7 @@ pipeline:
9292
Tag exec.wasi.local
9393
WASI_Path /path/to/wasi_built_json.wasm
9494
# For security reasons, WASM/WASI program cannot access its outer world
95-
# without accessible permissions. Uncomment below 'accessible_paths' and
95+
# without accessible permissions. Uncomment below 'accessible_paths' and
9696
# run Fluent Bit from the 'wasi_path' location:
9797
# accessible_paths /path/to/fluent-bit
9898

@@ -104,4 +104,5 @@ pipeline:
104104
{% endtab %}
105105
{% endtabs %}
106106

107-
For an example that handles structured logs, see the [Rust `serde-json` example](https://github.com/fluent/fluent-bit/tree/master/examples/wasi_serde_json).
107+
For an example that handles structured logs, see the [Rust `serde-json`
108+
example](https://github.com/fluent/fluent-bit/tree/master/examples/wasi_serde_json).

vale-styles/FluentBit/Headings.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,5 +121,6 @@ exceptions:
121121
- Visual
122122
- Vivo Exporter
123123
- VS
124+
- Wasm
124125
- WebSocket
125126
- Windows

0 commit comments

Comments
 (0)