构建和安装
Fluent Bit 使用 CMake 作为构建系统。建议的准备构建系统的过程包括以下步骤:
环境准备
在以下步骤中,您可以找到使用默认选项构建和安装项目的正确命令。如果您已经知道 CMake 的工作原理,则可以跳过此部分并查看可用的构建选项。
转到 Fluent Bit 源代码中的 build/
目录
$ cd build/
使用 CMake 配置项目以确定安装根路径的位置:
$ cmake ../
-- The C compiler identification is GNU 4.9.2
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- The CXX compiler identification is GNU 4.9.2
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
...
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- Looking for accept4
-- Looking for accept4 - not found
-- Configuring done
-- Generating done
-- Build files have been written to: /home/edsiper/coding/fluent-bit/build
现在您可以通过简单的 make
命令开始编译过程:
$ make
Scanning dependencies of target msgpack
[ 2%] Building C object lib/msgpack-1.1.0/CMakeFiles/msgpack.dir/src/unpack.c.o
[ 4%] Building C object lib/msgpack-1.1.0/CMakeFiles/msgpack.dir/src/objectc.c.o
[ 7%] Building C object lib/msgpack-1.1.0/CMakeFiles/msgpack.dir/src/version.c.o
...
[ 19%] Building C object lib/monkey/mk_core/CMakeFiles/mk_core.dir/mk_file.c.o
[ 21%] Building C object lib/monkey/mk_core/CMakeFiles/mk_core.dir/mk_rconf.c.o
[ 23%] Building C object lib/monkey/mk_core/CMakeFiles/mk_core.dir/mk_string.c.o
...
Scanning dependencies of target fluent-bit-static
[ 66%] Building C object src/CMakeFiles/fluent-bit-static.dir/flb_pack.c.o
[ 69%] Building C object src/CMakeFiles/fluent-bit-static.dir/flb_input.c.o
[ 71%] Building C object src/CMakeFiles/fluent-bit-static.dir/flb_output.c.o
...
Linking C executable ../bin/fluent-bit
[100%] Built target fluent-bit-bin
继续在系统上安装二进制文件,只需执行以下操作:
$ make install
您可能需要 root 权限,因此可以尝试在命令前加上 sudo
。
构建选项
Fluent Bit 提供了 CMake 的某些选项,这些选项可以在配置时启用或禁用,请参考下面的 General Options, Development Options, Input Plugins 和 Output Plugins 部分。
General Options
选项 | 描述 | 默认值 |
---|---|---|
FLB_ALL | 启用所有可用功能 | No |
FLB_JEMALLOC | 使用 Jemalloc 为默认的内存分配器 | No |
FLB_TLS | SSL/TLS 支持 | No |
FLB_BINARY | 生成可执行文件 | Yes |
FLB_EXAMPLES | 生成示例 | Yes |
FLB_SHARED_LIB | 构建共享库 | Yes |
FLB_MTRACE | 启用 mtrace 支持 | No |
FLB_INOTIFY | 启用 Inotify 支持 | Yes |
FLB_POSIX_TLS | 强制 POSIX 线程存储 | No |
FLB_SQLDB | 启用 SQL 嵌入式数据库支持 | No |
FLB_HTTP_SERVER | 启用 HTTP 服务器 | No |
FLB_LUAJIT | 启用 Lua 脚本支持 | Yes |
FLB_RECORD_ACCESSOR | 启用记录访问器 | Yes |
FLB_SIGNV4 | 启用 AWS Signv4 支持 | Yes |
FLB_STATIC_CONF | 使用静态配置文件构建二进制文件。此选项的值必须是包含配置文件的目录. | |
FLB_STREAM_PROCESSOR | 启用流处理器 | Yes |
Development Options
选项 | 描述 | 默认值 |
---|---|---|
FLB_DEBUG | 使用 debug 模式构建二进制文件 | No |
FLB_VALGRIND | 启用 Valgrind 支持 | No |
FLB_TRACE | 启用跟踪模式 | No |
FLB_SMALL | 最小化二进制大小 | No |
FLB_TESTS_RUNTIME | 启用运行时测试 | No |
FLB_TESTS_INTERNAL | 启用内部测试 | No |
FLB_TESTS | 启用测试 | No |
FLB_BACKTRACE | 启用反向跟踪/堆栈跟踪支持 | Yes |
Input Plugins
输出插件 提供了从特定的源类型(可以是网络接口,某些内置指标或通过特定的输入设备)收集信息的某些功能,可以使用以下输入插件:
选项 | 描述 | 默认值 |
---|---|---|
FLB_IN_COLLECTD | Enable Collectd input plugin | On |
FLB_IN_CPU | Enable CPU input plugin | On |
FLB_IN_DISK | Enable Disk I/O Metrics input plugin | On |
FLB_IN_DOCKER | Enable Docker metrics input plugin | On |
FLB_IN_EXEC | Enable Exec input plugin | On |
FLB_IN_FORWARD | Enable Forward input plugin | On |
FLB_IN_HEAD | Enable Head input plugin | On |
FLB_IN_HEALTH | Enable Health input plugin | On |
FLB_IN_KMSG | Enable Kernel log input plugin | On |
FLB_IN_MEM | Enable Memory input plugin | On |
FLB_IN_MQTT | Enable MQTT Server input plugin | On |
FLB_IN_NETIF | Enable Network I/O metrics input plugin | On |
FLB_IN_PROC | Enable Process monitoring input plugin | On |
FLB_IN_RANDOM | Enable Random input plugin | On |
FLB_IN_SERIAL | Enable Serial input plugin | On |
FLB_IN_STDIN | Enable Standard input plugin | On |
FLB_IN_SYSLOG | Enable Syslog input plugin | On |
FLB_IN_SYSTEMD | Enable Systemd / Journald input plugin | On |
FLB_IN_TAIL | Enable Tail (follow files) input plugin | On |
FLB_IN_TCP | Enable TCP input plugin | On |
FLB_IN_THERMAL | Enable system temperature(s) input plugin | On |
FLB_IN_WINLOG | Enable Windows Event Log input plugin (Windows Only) | On |
Filter Plugins
Filter plugins 允许修改,丰富或删除记录。下表描述了此版本中可用的过滤器:
选项 | 描述 | 默认值 |
---|---|---|
FLB_FILTER_AWS | Enable AWS metadata filter | On |
FLB_FILTER_EXPECT | Enable Expect data test filter | On |
FLB_FILTER_GREP | Enable Grep filter | On |
FLB_FILTER_KUBERNETES | Enable Kubernetes metadata filter | On |
FLB_FILTER_LUA | Enable Lua scripting filter | On |
FLB_FILTER_MODIFY | Enable Modify filter | On |
FLB_FILTER_NEST | Enable Nest filter | On |
FLB_FILTER_PARSER | Enable Parser filter | On |
FLB_FILTER_RECORD_MODIFIER | Enable Record Modifier filter | On |
FLB_FILTER_REWRITE_TAG | Enable Rewrite Tag filter | On |
FLB_FILTER_STDOUT | Enable Stdout filter | On |
FLB_FILTER_THROTTLE | Enable Throttle filter | On |
Output Plugins
Output plugins 提供将信息刷新到某些外部接口,服务或终端的能力,下表描述了此版本可用的输出插件
选项 | 描述 | 默认值 |
---|---|---|
FLB_OUT_AZURE | Enable Microsoft Azure output plugin | On |
FLB_OUT_BIGQUERY | Enable Google BigQuery output plugin | On |
FLB_OUT_COUNTER | Enable Counter output plugin | On |
FLB_OUT_DATADOG | Enable Datadog output plugin | On |
FLB_OUT_ES | Enable Elastic Search output plugin | On |
FLB_OUT_FILE | Enable File output plugin | On |
FLB_OUT_FLOWCOUNTER | Enable Flowcounter output plugin | On |
FLB_OUT_FORWARD | Enable Fluentd output plugin | On |
FLB_OUT_GELF | Enable Gelf output plugin | On |
FLB_OUT_HTTP | Enable HTTP output plugin | On |
FLB_OUT_INFLUXDB | Enable InfluxDB output plugin | On |
FLB_OUT_KAFKA | Enable Kafka output | Off |
FLB_OUT_KAFKA_REST | Enable Kafka REST Proxy output plugin | On |
FLB_OUT_LIB | Enable Lib output plugin | On |
FLB_OUT_NATS | Enable NATS output plugin | Off |
FLB_OUT_NULL | Enable NULL output plugin | On |
FLB_OUT_PGSQL | Enable PostgreSQL output plugin | On |
FLB_OUT_PLOT | Enable Plot output plugin | On |
FLB_OUT_SLACK | Enable Slack output plugin | On |
FLB_OUT_SPLUNK | Enable Splunk output plugin | On |
FLB_OUT_STACKDRIVER | Enable Google Stackdriver output plugin | On |
FLB_OUT_STDOUT | Enable STDOUT output plugin | On |
FLB_OUT_TCP | Enable TCP/TLS output plugin | On |
FLB_OUT_TD | Enable Treasure Data output plugin | On |