# Build with static configuration

[Fluent Bit](https://fluentbit.io) in normal operation mode is configurable through text files 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 includes a built-in configuration in the final binary of Fluent Bit, disabling the usage of external files or flags at runtime.

## Get started

### Requirements

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](/manual/4.0/installation/downloads/source/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. This directory must contain a minimum of one configuration file, called `fluent-bit.conf`, that contains the required [`SERVICE`](/manual/4.0/administration/configuring-fluent-bit/yaml/service-section.md), [`INPUT`](/manual/4.0/data-pipeline/inputs.md), and [`OUTPUT`](/manual/4.0/data-pipeline/outputs.md) sections.

As an example, create a new `fluent-bit.yaml` file or `fluent-bit.conf` file:

{% tabs %}
{% tab title="fluent-bit.yaml" %}

```yaml
service:
  flush: 1
  daemon: off
  log_level: info

pipeline:
  inputs:
    - name: cpu

  outputs:
    - name: stdout
      match: '*'
```

{% endtab %}

{% tab title="fluent-bit.conf" %}

```
[SERVICE]
  Flush     1
  Daemon    off
  Log_Level info

[INPUT]
  Name      cpu

[OUTPUT]
  Name      stdout
  Match     *
```

{% endtab %}
{% endtabs %}

This configuration calculates CPU metrics from the running system and prints them to the standard output interface.

#### Build with custom configuration

1. Go to the Fluent Bit source code build directory:

   ```shell
   cd fluent-bit/build/
   ```
2. Run CMake, appending the `FLB_STATIC_CONF` option pointing to the configuration directory recently created:

   ```shell
   cmake -DFLB_STATIC_CONF=/path/to/my/confdir/
   ```
3. Build Fluent Bit:

   ```shell
   make
   ```

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

```shell
$ bin/fluent-bit

...
[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}]
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.fluentbit.io/manual/4.0/installation/downloads/source/build-with-static-configuration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
