# Fluent Bit

Copy as Markdown[Open in ChatGPT](https://chatgpt.com/?q=Read%20https%3A%2F%2Fdocs-docusaurus.kinsta.page%2Fintegrations%2Ffiles%2Ffluent-bit.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)[Open in Claude](https://claude.ai/new?q=Read%20https%3A%2F%2Fdocs-docusaurus.kinsta.page%2Fintegrations%2Ffiles%2Ffluent-bit.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)

Coralogix provides seamless integration with Fluent Bit, allowing you to send your logs from anywhere and parse them according to your needs.

Coralogix supports Fluent Bit **v2.0.7** and onwards. From **v3.2.10** and onwards, we recommend using YAML syntax. This page covers both YAML and classic syntax.

## Prerequisites[​](#prerequisites "Direct link to Prerequisites")

* Fluent Bit [installed](https://docs.fluentbit.io/manual/installation/getting-started-with-fluent-bit)

## Environment Variables[​](#environment-variables "Direct link to Environment Variables")

Unless you want to hardcode your values into their appropriate positions, you must export the following four environment variables when deploying the Fluent Bit integration.

| Variable                     | Description                                                                                                                                                                                                                                                                                                                                                                                               |
| ---------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Api\_Key                     | Your [**Send-Your-Data API key**](https://docs-docusaurus.kinsta.page/user-guides/account-management/api-keys/send-your-data-api-key/.md) is a unique ID that represents your Coralogix team. Input the key without quotation marks or apostrophes.                                                                                                                                                       |
| Application\_Name            | The name of your **[application](https://docs-docusaurus.kinsta.page/user-guides/account-management/account-settings/application-and-subsystem-names/.md)**, as will appear in your Coralogix dashboard. For example, a company named SuperData might insert the SuperData string parameter. If SuperData wants to debug its test environment, it might use SuperData–Test.                               |
| SubSystem\_Name              | The name of your [**subsystem**](https://docs-docusaurus.kinsta.page/user-guides/account-management/account-settings/application-and-subsystem-names/.md), as will appear in your Coralogix dashboard. Applications often have multiple subsystems (ie. Backend Servers, Middleware, Frontend Servers, etc.). In order to help you examine the data you need, inserting the subsystem parameter is vital. |
| Endpoint                     | Choose the <!-- -->https\://ingress./logs/v1/singles<!-- --> endpoint that corresponds to your Coralogix [**domain**](https://docs-docusaurus.kinsta.page/user-guides/account-management/account-settings/coralogix-domain/.md) using the domain selector at the top of the page.                                                                                                                         |
| Enter only the FQDN portion. |                                                                                                                                                                                                                                                                                                                                                                                                           |
| Example: **ingress.**        |                                                                                                                                                                                                                                                                                                                                                                                                           |

## Configuration[​](#configuration "Direct link to Configuration")

Open your existing `Fluent-Bit` configuration file and add the following:

YAML syntax:

```
pipeline:

  filters:

    - name: nest

      match: '*'

      operation: nest

      wildcard:

        - '*'

      nest_under: text



    - name: modify

      match: '*'

      add:

        - applicationName ${Application_Name}

        - subsystemName ${SubSystem_Name}

        - computerName ${HOSTNAME}

  outputs:

    - name: http

      match: '*'

      host:  https://ingress.eu2.coralogix.com/logs/v1/singles

      port: 443

      uri: /logs/v1/singles

      format: json_lines

      tls: on

      header: Authorization Bearer ${Api_Key}

      compress: gzip

      retry_limit: 10
```

Classic syntax:

```
[FILTER]

        Name            nest

        Match           *

        Operation       nest

        Wildcard        *

        Nest_under      text

[FILTER]

        Name            modify

        Match           *

        Add             applicationName ${Application_Name}

        Add             subsystemName ${SubSystem_Name}

        Add             computerName ${HOSTNAME}

[OUTPUT]

        Name            http

        Match           *

        Host            https://ingress.eu2.coralogix.com/logs/v1/singles

        Port            443

        URI             /logs/v1/singles

        Format          json_lines

        TLS             On

        Header          Authorization Bearer ${Api_Key}

        compress        gzip

        Retry_Limit     10
```

### Application and Subsystem Name[​](#application-and-subsystem-name "Direct link to Application and Subsystem Name")

If you wish to set your [application and subsystem names](https://docs-docusaurus.kinsta.page/user-guides/account-management/account-settings/application-and-subsystem-names/.md) as fixed values, use Application\_Name and SubSystem\_Name as described above in your configuration file.

If your input stream is a `JSON` object, you can extract an Application\_Name and/or SubSystem\_Name from the `JSON` by adding our LUA filter just before the OUTPUT:

YAML syntax:

```
pipeline:

  filters:

    - name: lua

      match: '*'

      call: set_cx_keys

      code: |

        function set_cx_keys(tag, timestamp, record)

           new_record = record

           new_record["applicationName"] = record["<your_app_key>"]

           new_record["subsystemName"] = record["parent_key"]["<your_subsystem_key>"]

           return 2, timestamp, new_record

        end
```

Classic syntax:

```
[FILTER]

  Name    lua

  Match   *

  call set_cx_keys

  code function set_cx_keys(tag, timestamp, record) new_record = record	new_record["applicationName"] = record["<your_app_key>"] new_record["subsystemName"] = record["parent_key"]["<your_subsystem_key>"] return 2, timestamp, new_record end
```

For instance, in the following example, `JSON` `new_record["applicationName"] = record["application"]` will extract "testApp" into the Coralogix applicationName.

```
{

    "application": "testApp",

    "subsystem": "testSub",

    "code": "200",

    "stream": "stdout",

    "timestamp": "2016-07-20T17:05:17.743Z",

    "message": "hello_world",

}
```

**Notes**:

* Nested JSONs are supported.

* Extract nested values as your `applicationName` and/or `subsystemName`.

### Example[​](#example "Direct link to Example")

The following is an example configuration.

YAML syntax:

```
service:

  daemon: off

  flush: 1

  log_level: info

pipeline:

  inputs:

    - name: dummy

      tag: dummy_input

      rate: 1

  filters:

    - name: nest

      match: '*'

      operation: nest

      wildcard:

        - '*'

      nest_under: text



    - name: modify

      match: '*'

      add:

        - computerName ${HOSTNAME}



    - name: lua

      match: '*'

      call: applicationNameFromEnv

      code: |

        function applicationNameFromEnv(tag, timestamp, record)

           record["applicationName"] = record["computerName"] or os.getenv("Application_Name")

           return 2, timestamp, record

        end



    - name: lua

      match: '*'

      call: subsystemNameFromEnv

      code: |

        function subsystemNameFromEnv(tag, timestamp, record)

           record["subsystemName"] = tag or os.getenv("SubSystem_Name")

           return 2, timestamp, record

        end

  outputs:

    - name: stdout

      match: '*'

    - name: http

      match: '*'

      host:  https://ingress.eu2.coralogix.com/logs/v1/singles

      port: 443

      uri: /logs/v1/singles

      format: json_lines

      tls: on

      header: Authorization Bearer ${Api_Key}

      compress: gzip

      retry_limit: 10
```

Classic syntax:

```
[SERVICE]

    Flush           1

    Daemon          Off

    Log_Level       info

    Parsers_File    parsers.conf



[INPUT]

    Name            dummy

    Tag             dummy_input

    Rate            1



[OUTPUT]

    Name            stdout

    Match           *



[FILTER]

    Name            nest

    Match           *

    Operation       nest

    Wildcard        *

    Nest_under      text



[FILTER]

    Name            modify

    Match           *

    Add             computerName ${HOSTNAME}



[FILTER]

    Name            lua

    Match           *

    call            applicationNameFromEnv

    code            function applicationNameFromEnv(tag, timestamp, record) record["applicationName"] = record["computerName"] or os.getenv("Application_Name") return 2, timestamp, record end



[FILTER]

    Name            lua

    Match           *

    call            subsystemNameFromEnv

    code            function subsystemNameFromEnv(tag, timestamp, record) record["subsystemName"] = tag or os.getenv("SubSystem_Name") return 2, timestamp, record end



[OUTPUT]

    Name            http

    Match           *

    Host            https://ingress.eu2.coralogix.com/logs/v1/singles

    Port            443

    URI             /logs/v1/singles

    Format          json_lines

    TLS             On

    Header          Authorization Bearer ${Api_Key}

    compress        gzip

    Retry_Limit     10
```

## Additional resources[​](#additional-resources "Direct link to Additional resources")

|                     |                                                                                                                 |
| ------------------- | --------------------------------------------------------------------------------------------------------------- |
| External link       | [GitHub](https://github.com/coralogix/telemetry-shippers/tree/fluent-bit-standalone/logs/fluent-bit/standalone) |
| Coralogix Endpoints | [Coralogix Endpoints](https://docs-docusaurus.kinsta.page/integrations/coralogix-endpoints/.md)                 |
