Fluent Bitを触ってみました。備忘録です。 Fluent BitとはCNFCのサブプロジェクトでOSSのログコレクターとのこと。多くのSIEM/SOARベンダーがコレクターとして利用しているっぽいですね。MacBookにHomebrewがインストール済であることを前提としています。
Homebrewでインストール
$ brew install fluent-bit
サンプルのログをパースしてみた。
$ fluent-bit -i tail -p path=./sample.log -p parser=json -p read_from_head=true -R /opt/homebrew/etc/fluent-bit/parsers.conf -o stdout -f 1
Fluent Bit v3.0.6
* Copyright (C) 2015-2024 The Fluent Bit Authors
* Fluent Bit is a CNCF sub-project under the umbrella of Fluentd
* https://fluentbit.io
___________.__ __ __________.__ __ ________
\_ _____/| | __ __ ____ _____/ |_ \______ \__|/ |_ ___ _\_____ \
| __) | | | | \_/ __ \ / \ __\ | | _/ \ __\ \ \/ / _(__ <
| \ | |_| | /\ ___/| | \ | | | \ || | \ / / \
\___ / |____/____/ \___ >___| /__| |______ /__||__| \_/ /______ /
\/ \/ \/ \/ \/
[2024/06/05 12:34:20] [ info] [fluent bit] version=3.0.6, commit=, pid=23856
[2024/06/05 12:34:20] [ info] [storage] ver=1.5.2, type=memory, sync=normal, checksum=off, max_chunks_up=128
[2024/06/05 12:34:20] [ info] [cmetrics] version=0.9.0
[2024/06/05 12:34:20] [ info] [ctraces ] version=0.5.1
[2024/06/05 12:34:20] [ info] [input:tail:tail.0] initializing
[2024/06/05 12:34:20] [ info] [input:tail:tail.0] storage_strategy='memory' (memory only)
[2024/06/05 12:34:20] [ info] [output:stdout:stdout.0] worker #0 started
[2024/06/05 12:34:20] [ info] [sp] stream processor started
[0] tail.0: [[1717558460.957882000, {}], {"date"=>"22/abr/2019:12:43:51 -0600", "ip"=>"73.113.230.135", "word"=>"balsamine", "country"=>"Japan", "flag"=>false, "num"=>96}]
おしまい。