Back to index page

CEPTORD.NET                                              Fujimoto Seiji
                                                               May 2020

             How to Start Fluent Bit Development on Windows

Table of Contents

    1. Introduction
    2. Preparation
    3. Compile Fluent Bit
    4. First Step towards Development
    5. License

1. Introduction

    Fluent Bit is a fast log forwarder written in C. You can use this
    program to push your log data from one server (like webapp server)
    into another server (like log management server).

    You can think of Fluent Bit as generalized syslogd. Both Fluent
    Bit and syslogd can be used to send log data from one place to
    another, but Fluent Bit, unlike syslogd, is designed to support a
    variety of network protocols such as:

     1. Syslog protocol for system logging.
     2. MQTT for telemetry messaging.
     3. StatsD protocol for statical data.
     4. Rest API for Web based applications.
     5. ...

    In 2019, Fluent Bit expanded its support platform to Windows. So
    you can now transfer log data from your Windows boxes. I (the
    author of this article) was one of the developers behind the
    porting effort.

    Since there seems to be growing interest in the Windows port
    among the community, I want to provide a detailed instruction to
    set up development environment for Fluent Bit.

2.  Preparation

2.1. Install Microsoft Visual C++

    You need a C compiler to compile Fluent Bit. On Windows, you can
    use Microsoft Visual C++ for that purpose.

    Launch Powershell, and type the following commands:

    PS> wget -o vs.exe https://aka.ms/vs/16/release/vs_buildtools.exe
    PS> start vs.exe

    Run the installer, and choose "C++ Build Tools" when asked which
    packages to install.

2.2. Install Other Required Tools

    Fluent Bit depends on the following tools other than the C compiler.

     - Git (for code management)
       https://git-scm.com/download/win
     - Flex and Bison (for parser generation)
       https://github.com/lexxmark/winflexbison/releases

    Download the resources from the links above, and go thorough the
    wizards. For flex and bison, you need to rename win_flex.exe and
    win_bison.exe to flex.exe and bison.exe respectively.

    Alternativeky you can use the Windows package manager scoop.sh to
    automate the installation:

    PS> iwr -useb get.scoop.sh | iex
    PS> scoop install git
    PS> scoop install winflexbison

3.  Compile Fluent Bit

    Open the start menu on Windows and type "Developer Command Prompt".

    Clone the source code of Fluent Bit.

    % git clone https://github.com/fluent/fluent-bit
    % cd fluent-bit/build

    Compile the source code.

    % cmake ..
    % cmake --build .

    Now you should be able to run Fluent Bit:

    % .\bin\debug\fluent-bit.exe -i dummy -o stdout

4.  First Step towards Development

    If you are new to Fluent Bit, I recommend you to look at the "dummy"
    input plugin and study how the plugin system works.

    A good first step would be:

     1. Open plugins/in_dummy/dummy.h with notepad.exe.

     2. Find the definition of the macro DEFAULT_DUMMY_MESSAGE. Tweak
        its message to "Hello World!".

     3. Rebuild the source code.

        % cmake --build .

     4. Run Fluent Bit.

        % .\bin\debug\fluent-bi.exe -i dummy -o stdout

     Now you've done the first development of Fluent Bit.

5.  License

    I hereby place this article into the public domain. All my
    copyrights, including related and neighboring rights, of this work
    are abandoned.

    2020 Fujimoto Seiji <fujimoto@ceptord.net>