Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 43 additions & 21 deletions installation/sources/build-with-static-configuration.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,36 @@
# Build with Static Configuration
# Build with static configuration

[Fluent Bit](https://fluentbit.io) in normal operation mode allows to be configurable through [text files](https://github.com/fluent/fluent-bit-docs/tree/8ab2f4cda8dfdd8def7fa0cf5c7ffc23069e5a70/installation/configuration/file.md) or using specific arguments in the command line, while this is the ideal deployment case, there are scenarios where a more restricted configuration is required: static configuration mode.
[Fluent Bit](https://fluentbit.io) in normal operation mode is configurable through
[text files](/installation/configuration/file.md)
or using specific arguments in the command line. Although this is the ideal deployment
case, there are scenarios where a more restricted configuration is required. Static
configuration mode restricts configuration ability.

Static configuration mode aims to include a built-in configuration in the final binary of Fluent Bit, disabling the usage of external files or flags at runtime.
Static configuration mode includes a built-in configuration in the final binary of
Fluent Bit, disabling the usage of external files or flags at runtime.

## Getting Started
## Get started

### Requirements

The following steps assumes you are familiar with configuring Fluent Bit using text files and you have experience building it from scratch as described in the [Build and Install](https://github.com/fluent/fluent-bit-docs/tree/8ab2f4cda8dfdd8def7fa0cf5c7ffc23069e5a70/installation/sources/build_install.md) section.
The following steps assume you are familiar with configuring Fluent Bit using text
files and you have experience building it from scratch as described in
[Build and Install](build-and-install.md).

#### Configuration Directory

In your file system prepare a specific directory that will be used as an entry point for the build system to lookup and parse the configuration files. It is mandatory that this directory contain as a minimum one configuration file called _fluent-bit.conf_ containing the required [SERVICE](https://github.com/fluent/fluent-bit-docs/tree/8ab2f4cda8dfdd8def7fa0cf5c7ffc23069e5a70/installation/configuration/file.md#config_section), [INPUT](https://github.com/fluent/fluent-bit-docs/tree/8ab2f4cda8dfdd8def7fa0cf5c7ffc23069e5a70/installation/sources/configuration/file.md#config_input) and [OUTPUT](https://github.com/fluent/fluent-bit-docs/tree/8ab2f4cda8dfdd8def7fa0cf5c7ffc23069e5a70/installation/configuration/file.md#config_output) sections. As an example create a new _fluent-bit.conf_ file with the following content:
In your file system, prepare a specific directory that will be used as an entry
point for the build system to lookup and parse the configuration files. This
directory must contain a minimum of one configuration file called
`fluent-bit.conf` containing the required
[SERVICE](/administration/configuring-fluent-bit/yaml/service-section.md),
[INPUT](/concepts/data-pipeline/input.md), and [OUTPUT](/concepts/data-pipeline/output.md)
sections.

```python
As an example, create a new `fluent-bit.conf` file with the following
content:

```python copy
[SERVICE]
Flush 1
Daemon off
Expand All @@ -28,31 +44,37 @@ In your file system prepare a specific directory that will be used as an entry p
Match *
```

the configuration provided above will calculate CPU metrics from the running system and print them to the standard output interface.
This configuration calculates CPU metrics from the running system and prints them
to the standard output interface.

#### Build with Custom Configuration
#### Build with custom configuration

Inside Fluent Bit source code, get into the build/ directory and run CMake appending the FLB\_STATIC\_CONF option pointing the configuration directory recently created, e.g:
1. Go to the Fluent Bit source code build directory:

```bash
$ cd fluent-bit/build/
$ cmake -DFLB_STATIC_CONF=/path/to/my/confdir/
```
```bash copy
cd fluent-bit/build/
```

then build it:
1. Run CMake, appending the `FLB_STATIC_CONF` option pointing to
the configuration directory recently created:

```bash
$ make
```
```bash copy
cmake -DFLB_STATIC_CONF=/path/to/my/confdir/
```

1. Build Fluent Bit:

At this point the fluent-bit binary generated is ready to run without necessity of further configuration:
```bash copy
make
```

The generated `fluent-bit` binary is ready to run without additional configuration:

```bash
$ bin/fluent-bit
$ bin/fluent-bit
Fluent-Bit v0.15.0
Copyright (C) Treasure Data

[2018/10/19 15:32:31] [ info] [engine] started (pid=15186)
[0] cpu.local: [1539984752.000347547, {"cpu_p"=>0.750000, "user_p"=>0.500000, "system_p"=>0.250000, "cpu0.p_cpu"=>1.000000, "cpu0.p_user"=>1.000000, "cpu0.p_system"=>0.000000, "cpu1.p_cpu"=>0.000000, "cpu1.p_user"=>0.000000, "cpu1.p_system"=>0.000000, "cpu2.p_cpu"=>0.000000, "cpu2.p_user"=>0.000000, "cpu2.p_system"=>0.000000, "cpu3.p_cpu"=>1.000000, "cpu3.p_user"=>1.000000, "cpu3.p_system"=>0.000000}]
```

Loading