Exec WASI 입력 플러그인
WASI 대상인 Wasm 프로그램을 외부 프로그램처럼 실행하고 거기서 이벤트 로그를 수집하고 싶을 때 쓰는 입력 플러그인입니다. 함께 살펴보겠습니다.
출처: 문서
본문
{% hint style="info" %}
Supported event types: logs
{% endhint %}
Exec WASI 입력 플러그인은 WASI 대상인 Wasm 프로그램을 외부 프로그램처럼 실행하고 거기서 이벤트 로그를 수집할 수 있게 해 줍니다.
Configuration parameters
플러그인은 다음 구성 파라미터를 지원합니다:
| Key | Description | Default |
|---|---|---|
accessible_paths |
Specify the allowed list of paths to be able to access paths from Wasm programs. | . |
buf_size |
Size of the buffer. Review unit sizes for allowed values. | 4096 |
interval_nsec |
Polling interval (nanosecond). | 0 |
interval_sec |
Polling interval (seconds). | 1 |
oneshot |
Execute the command only once at startup. | false |
parser |
Specify the name of a parser to interpret the entry as a structured message. | |
threaded |
Indicates whether to run this input in its own thread. | false |
wasi_path |
The location of a Wasm program file. | |
wasm_heap_size |
Size of the heap size of Wasm execution. Review unit sizes for allowed values. | 8192 |
wasm_stack_size |
Size of the stack size of Wasm execution. Review unit sizes for allowed values. | 8192 |
Configuration examples
다음은 구성 예시입니다.
in_exec_wasi는 파서를 처리할 수 있어요. Wasm 프로그램에서 구조화된 데이터를 가져오려면 parser.conf를 만들어야 합니다:
time_format은 사용 중인 타임스탬프 형식에 맞춰 정렬되어야 합니다.
이 예시는 Wasm 프로그램이 JSON 스타일 문자열을 stdout에 쓴다고 가정합니다.
{% tabs %} {% tab title="parsers.yaml" %}
parsers:
- name: wasi
format: json
time_key: time
time_format: '%Y-%m-%dT%H:%M:%S.%L %z'
{% endtab %}
{% tab title="parsers.conf" %}
[PARSER]
Name wasi
Format json
Time_Key time
Time_Format %Y-%m-%dT%H:%M:%S.%L %z
{% endtab %} {% endtabs %}
그런 다음 주 Fluent Bit 구성에서 parsers.conf를 지정할 수 있어요:
{% tabs %} {% tab title="fluent-bit.yaml" %}
service:
flush: 1
daemon: off
# Configure this to load your custom parser if required
# parsers_file: parsers.yaml
log_level: info
http_server: off
http_listen: 0.0.0.0
http_port: 2020
pipeline:
inputs:
- name: exec_wasi
tag: exec.wasi.local
wasi_path: /path/to/wasi/program.wasm
# Note: run from the 'wasi_path' location.
accessible_paths: /path/to/accessible
parser: wasi
outputs:
- name: stdout
match: '*'
{% endtab %}
{% tab title="fluent-bit.conf" %}
[SERVICE]
Flush 1
Daemon Off
# Configure this to load your custom parser if required
# Parsers_File parsers.conf
Log_Level info
HTTP_Server Off
HTTP_Listen 0.0.0.0
HTTP_Port 2020
[INPUT]
Name exec_wasi
Tag exec.wasi.local
Wasi_Path /path/to/wasi/program.wasm
Accessible_Paths .,/path/to/accessible
Parser wasi
[OUTPUT]
Name stdout
Match *
{% endtab %} {% endtabs %}