fluent-bit 学习-4

学习fluent-bit的streamprocessor
安装fluent-bit

创建配置文件mytest.conf

[SERVICE]
    Flush        1
    Log_Level    debug
    Streams_File stream_processor.conf
    Parsers_File parsers.conf

[INPUT]
    Name         tail
    Refresh_Interval 5
    path  *.log
    alias        my_tail
    parser json

[OUTPUT]
    Name         stdout

创建stream_processor.conf

[STREAM_TASK]
    Name   stream_test
    Exec   CREATE STREAM mystream WITH (tag='results') AS SELECT mykey from STREAM:my_tail where mykey >3 ;

创建parsers.conf

[PARSER]
    Name   json
    Format json
    Time_Key time
    Time_Format %d/%b/%Y:%H:%M:%S %z

运行fluent-bit

fluent-bit  -c mytest.conf

验证

echo '{"mykey":1}' >> mylog.log
echo '{"mykey":4}' >> mylog.log