summaryrefslogtreecommitdiffstats
path: root/fluent-bit/examples/filter_wasm_go/README.md
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-03-09 13:19:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-03-09 13:20:02 +0000
commit58daab21cd043e1dc37024a7f99b396788372918 (patch)
tree96771e43bb69f7c1c2b0b4f7374cb74d7866d0cb /fluent-bit/examples/filter_wasm_go/README.md
parentReleasing debian version 1.43.2-1. (diff)
downloadnetdata-58daab21cd043e1dc37024a7f99b396788372918.tar.xz
netdata-58daab21cd043e1dc37024a7f99b396788372918.zip
Merging upstream version 1.44.3.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'fluent-bit/examples/filter_wasm_go/README.md')
-rw-r--r--fluent-bit/examples/filter_wasm_go/README.md63
1 files changed, 63 insertions, 0 deletions
diff --git a/fluent-bit/examples/filter_wasm_go/README.md b/fluent-bit/examples/filter_wasm_go/README.md
new file mode 100644
index 000000000..863cf8360
--- /dev/null
+++ b/fluent-bit/examples/filter_wasm_go/README.md
@@ -0,0 +1,63 @@
+# Fluent Bit / filter_wasm_go
+
+This source source tree provides an example of WASM filter program with WASI mode.
+
+## Prerequisites
+
+Tested on
+
+* TinyGo
+ * [tinygo](https://tinygo.org/) tinygo version 0.23.0 linux/amd64 (using go version go1.18.2 and LLVM version 14.0.0)
+ * [tinygo](https://tinygo.org/) tinygo version 0.24.0 linux/amd64 (using go version go1.18.2 and LLVM version 14.0.0)
+
+For Ubuntu, it's easy to install with:
+
+```console
+$ wget https://github.com/tinygo-org/tinygo/releases/download/v0.24.0/tinygo_0.24.0_amd64.deb
+$ sudo dpkg -i tinygo_0.24.0_amd64.deb
+```
+
+## How to build
+
+Execute _tinygo build_ as follows:
+
+```console
+$ tinygo build -wasm-abi=generic -target=wasi -o filter.wasm filter.go
+```
+
+Finally, under the same directory, `*.wasm` file will be created:
+
+```console
+$ ls *.wasm
+filter.wasm
+```
+
+## How to confirm WASM filter integration
+
+Create fluent-bit configuration file as follows:
+
+```ini
+[SERVICE]
+ Flush 1
+ Daemon Off
+ Log_Level info
+ HTTP_Server Off
+ HTTP_Listen 0.0.0.0
+ HTTP_Port 2020
+
+[INPUT]
+ Name dummy
+ Tag dummy.local
+
+[FILTER]
+ Name wasm
+ match dummy.*
+ WASM_Path /path/to/filter.wasm
+ Function_Name go_filter
+ accessible_paths .,/path/to/fluent-bit
+
+[OUTPUT]
+ Name stdout
+ Match *
+
+```