macOS
Fluent Bit is compatible with latest Apple macOS system on x86_64 and Apple Silicon M1 architectures. At the moment there is no official supported package but you can build it from sources by following the instructions below.

Requirements

For the next steps, you will need to have Homebrew installed in your system, if is not there, you can install it with the following command:
1
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Copied!

Install build dependencies

Run the following brew command in your terminal to retrieve the dependencies:
1
brew install git cmake openssl bison
Copied!

Get the source and build it

Grab a fresh copy of the Fluent Bit source code (upstream):
1
git clone https://github.com/fluent/fluent-bit
2
cd fluent-bit
Copied!
Optionally, if you want to use a specific version, just checkout to the proper tag. If you want to use v1.8.13 just do:
1
git checkout v1.8.13
Copied!
In order to prepare the build system, we need to expose certain environment variables so Fluent Bit CMake build rules can pick the right libraries:
1
export OPENSSL_ROOT_DIR=`brew --prefix openssl`
2
export PATH=`brew --prefix bison`/bin:$PATH
Copied!
Change to the build/ directory inside the Fluent Bit sources:
1
$ cd build/
Copied!
Build Fluent Bit. Note that we are indicating to the build system "where" the final binaries and config files should be installed:
1
cmake -DFLB_DEV=on -DCMAKE_INSTALL_PREFIX=/opt/fluent-bit ../
2
make -j 16
Copied!
Install the data. Note that this requires root privileges due to the directory we will write information to:
1
sudo make install
Copied!
The binaries and configuration examples can be located at /opt/fluent-bit/.

Create macOS installer from source

Grab a fresh copy of the Fluent Bit source code (upstream):
1
git clone https://github.com/fluent/fluent-bit
2
cd fluent-bit
Copied!
Optionally, if you want to use a specific version, just checkout to the proper tag. If you want to use v1.9.2 just do:
1
git checkout v1.9.2
Copied!
In order to prepare the build system, we need to expose certain environment variables so Fluent Bit CMake build rules can pick the right libraries:
1
export OPENSSL_ROOT_DIR=`brew --prefix openssl`
2
export PATH=`brew --prefix bison`/bin:$PATH
Copied!
And then, creating the specific macOS SDK target (For example, sepcifying macOS Big Sur (11.3) SDK environment):
1
export MACOSX_DEPLOYMENT_TARGET=11.3
Copied!
Build Fluent Bit macOS installer.
1
cmake -DCPACK_GENERATOR=productbuild -DCMAKE_INSTALL_PREFIX=/opt/fluent-bit ../
2
make -j 16
3
cpack -G productbuild
Copied!
Then, macOS installer will be generated as:
1
CPack: Create package using productbuild
2
CPack: Install projects
3
CPack: - Run preinstall target for: fluent-bit
4
CPack: - Install project: fluent-bit []
5
CPack: - Install component: binary
6
CPack: - Install component: library
7
CPack: - Install component: headers
8
CPack: - Install component: headers-extra
9
CPack: Create package
10
CPack: - Building component package: /Users/fluent-bit-builder/GitHub/fluent-bit/build/_CPack_Packages/Darwin/productbuild//Users/fluent-bit-builder/GitHub/fluent-bit/build/fluent-bit-1.9.2-apple/Contents/Packages/fluent-bit-1.9.2-apple-binary.pkg
11
CPack: - Building component package: /Users/fluent-bit-builder/GitHub/fluent-bit/build/_CPack_Packages/Darwin/productbuild//Users/fluent-bit-builder/GitHub/fluent-bit/build/fluent-bit-1.9.2-apple/Contents/Packages/fluent-bit-1.9.2-apple-headers.pkg
12
CPack: - Building component package: /Users/fluent-bit-builder/GitHub/fluent-bit/build/_CPack_Packages/Darwin/productbuild//Users/fluent-bit-builder/GitHub/fluent-bit/build/fluent-bit-1.9.2-apple/Contents/Packages/fluent-bit-1.9.2-apple-headers-extra.pkg
13
CPack: - Building component package: /Users/fluent-bit-builder/GitHub/fluent-bit/build/_CPack_Packages/Darwin/productbuild//Users/fluent-bit-builder/GitHub/fluent-bit/build/fluent-bit-1.9.2-apple/Contents/Packages/fluent-bit-1.9.2-apple-library.pkg
14
CPack: - package: /Users/fluent-bit-builder/GitHub/fluent-bit/build/fluent-bit-1.9.2-apple.pkg generated.
Copied!
Finally, fluent-bit-<fluent-bit version>-(intel or apple).pkg will be generated.
The created installer will put binaries at /opt/fluent-bit/.

Running Fluent Bit

To make the access path easier to Fluent Bit binary, in your terminal extend the PATH variable:
1
export PATH=/opt/fluent-bit/bin:$PATH
Copied!
Now as a simple test, try Fluent Bit by generating a simple dummy message which will be printed to the standard output interface every 1 second:
1
fluent-bit -i dummy -o stdout -f 1
Copied!
You will see an output similar to this:
1
Fluent Bit v1.9.0
2
* Copyright (C) 2015-2021 The Fluent Bit Authors
3
* Fluent Bit is a CNCF sub-project under the umbrella of Fluentd
4
* https://fluentbit.io
5
6
[2022/02/08 17:13:52] [ info] [engine] started (pid=14160)
7
[2022/02/08 17:13:52] [ info] [storage] version=1.1.6, initializing...
8
[2022/02/08 17:13:52] [ info] [storage] in-memory
9
[2022/02/08 17:13:52] [ info] [storage] normal synchronization mode, checksum disabled, max_chunks_up=128
10
[2022/02/08 17:13:52] [ info] [cmetrics] version=0.2.2
11
[2022/02/08 17:13:52] [ info] [sp] stream processor started
12
[0] dummy.0: [1644362033.676766000, {"message"=>"dummy"}]
13
[0] dummy.0: [1644362034.676914000, {"message"=>"dummy"}]
Copied!
To halt the process, press ctrl-c in the terminal.