Skip to content

Instantly share code, notes, and snippets.

@rupeshtiwari
Last active June 15, 2024 02:37
Show Gist options
  • Select an option

  • Save rupeshtiwari/9c8eeaea037c10466492446adb6293ef to your computer and use it in GitHub Desktop.

Select an option

Save rupeshtiwari/9c8eeaea037c10466492446adb6293ef to your computer and use it in GitHub Desktop.

Revisions

  1. rupeshtiwari revised this gist Oct 16, 2023. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion getting started with fluentbit.md
    Original file line number Diff line number Diff line change
    @@ -88,7 +88,10 @@ fluent-bit -i dummy -o stdout
    ```
    ps -aux|grep fluent-bit
    ```

    Killing fluent-bit process
    ```
    sudo kill -9 <process-id>
    ```

    ### Configuration File
    In your main configuration file append the following Input & Output sections:
  2. rupeshtiwari revised this gist Oct 16, 2023. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions getting started with fluentbit.md
    Original file line number Diff line number Diff line change
    @@ -83,6 +83,13 @@ fluent-bit -i dummy -o stdout
    [2] dummy.0: [1499345732.000267932, {"message"=>"dummy"}]
    [3] dummy.0: [1499345733.000757746, {"message"=>"dummy"}]
    ```

    ## check all fluent-bit process
    ```
    ps -aux|grep fluent-bit
    ```


    ### Configuration File
    In your main configuration file append the following Input & Output sections:

  3. rupeshtiwari revised this gist Sep 26, 2023. 1 changed file with 6 additions and 4 deletions.
    10 changes: 6 additions & 4 deletions getting started with fluentbit.md
    Original file line number Diff line number Diff line change
    @@ -1,12 +1,13 @@
    ## Single line install
    # EC2 instance setup for fluent-bit installation
    ## Step1: Single line install
    A simple installation script is provided to be used for most Linux targets. This will always install the most recent version released.
    ```
    curl https://raw.githubusercontent.com/fluent/fluent-bit/master/install.sh | sh
    ```
    This is purely a convenience helper and should always be validated prior to use. The recommended secure deployment approach is to follow the instructions below.


    ## Configure Yum
    ## Step2: Configure Yum
    We provide fluent-bit through a Yum repository. In order to add the repository reference to your system, please add a new file called fluent-bit.repo in /etc/yum.repos.d/ with the following content:
    Amazon Linux 2
    ```
    @@ -26,7 +27,7 @@ gpgcheck=1
    gpgkey=https://packages.fluentbit.io/fluentbit.key
    enabled=1
    ```
    ## Install Fluent-Bit
    ## Step3: Install Fluent-Bit
    Once your repository is configured, run the following command to install it:
    ```
    sudo yum install fluent-bit
    @@ -51,8 +52,9 @@ systemctl status fluent-bit
    The default configuration of fluent-bit is collecting metrics of CPU usage and sending the records to the standard output, you can see the outgoing data in your /var/log/messages file.


    ## step3: Write sample fluent-bit config

    ## fluent-bit dummy plugin
    ### fluent-bit dummy plugin
    The dummy input plugin, generates dummy events. It is useful for testing, debugging, benchmarking and getting started with Fluent Bit.

    ### Configuration Parameters for dummy
  4. rupeshtiwari revised this gist Sep 26, 2023. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions getting started with fluentbit.md
    Original file line number Diff line number Diff line change
    @@ -26,7 +26,7 @@ gpgcheck=1
    gpgkey=https://packages.fluentbit.io/fluentbit.key
    enabled=1
    ```
    ## Install
    ## Install Fluent-Bit
    Once your repository is configured, run the following command to install it:
    ```
    sudo yum install fluent-bit
    @@ -52,10 +52,10 @@ The default configuration of fluent-bit is collecting metrics of CPU usage and s



    ## Dummy
    ## fluent-bit dummy plugin
    The dummy input plugin, generates dummy events. It is useful for testing, debugging, benchmarking and getting started with Fluent Bit.

    ### Configuration Parameters
    ### Configuration Parameters for dummy
    The plugin supports the following configuration parameters:
    Key | Description
    --| --
    @@ -66,7 +66,7 @@ Rate | Rate at which messages are generated expressed in how many times per seco
    Samples | If set, the events number will be limited. e.g. If Samples=3, the plugin only generates three events and stops.
    Copies | Number of messages to generate each time they are generated. Defaults to 1.

    ### Getting Started
    ### Getting Started with fluent-bit dummy message producer code
    You can run the plugin from the command line or through the configuration file:
    Command Line

  5. rupeshtiwari revised this gist Sep 26, 2023. No changes.
  6. rupeshtiwari revised this gist Jul 12, 2023. No changes.
  7. rupeshtiwari revised this gist Jun 15, 2023. No changes.
  8. rupeshtiwari revised this gist Jun 15, 2023. 1 changed file with 142 additions and 1 deletion.
    143 changes: 142 additions & 1 deletion getting started with fluentbit.md
    Original file line number Diff line number Diff line change
    @@ -48,4 +48,145 @@ systemctl status fluent-bit
    └─3820 /opt/fluent-bit/bin/fluent-bit -c /etc/fluent-bit/fluent-bit.conf
    ...
    ```
    The default configuration of fluent-bit is collecting metrics of CPU usage and sending the records to the standard output, you can see the outgoing data in your /var/log/messages file.
    The default configuration of fluent-bit is collecting metrics of CPU usage and sending the records to the standard output, you can see the outgoing data in your /var/log/messages file.



    ## Dummy
    The dummy input plugin, generates dummy events. It is useful for testing, debugging, benchmarking and getting started with Fluent Bit.

    ### Configuration Parameters
    The plugin supports the following configuration parameters:
    Key | Description
    --| --
    Dummy | Dummy JSON record. Default: {"message":"dummy"}
    Start_time_sec | Dummy base timestamp in seconds. Default: 0
    Start_time_nsec | Dummy base timestamp in nanoseconds. Default: 0
    Rate | Rate at which messages are generated expressed in how many times per second. Default: 1
    Samples | If set, the events number will be limited. e.g. If Samples=3, the plugin only generates three events and stops.
    Copies | Number of messages to generate each time they are generated. Defaults to 1.

    ### Getting Started
    You can run the plugin from the command line or through the configuration file:
    Command Line

    ```
    fluent-bit -i dummy -o stdout
    ```
    ```
    [2017/07/06 21:55:29] [ info] [engine] started
    [0] dummy.0: [1499345730.015265366, {"message"=>"dummy"}]
    [1] dummy.0: [1499345731.002371371, {"message"=>"dummy"}]
    [2] dummy.0: [1499345732.000267932, {"message"=>"dummy"}]
    [3] dummy.0: [1499345733.000757746, {"message"=>"dummy"}]
    ```
    ### Configuration File
    In your main configuration file append the following Input & Output sections:

    ```yaml
    [INPUT]
    Name dummy
    Tag dummy.log

    [OUTPUT]
    Name stdout
    Match *
    ```

    ```
    # Run script
    /opt/fluent-bit/bin/fluent-bit -c /etc/fluent-bit/fb-dummy.conf
    ```

    ![image](https://user-images.githubusercontent.com/330383/245836882-41aada59-ee73-4f60-8a2a-8dbe7b9c9416.png)


    ## Generating random logs in JSON
    ```yaml
    [INPUT]
    Name dummy
    Tag dummy.log

    [OUTPUT]
    Name stdout
    Match dummy.log
    Format json_lines
    ```
    ```
    # Run script
    /opt/fluent-bit/bin/fluent-bit -c /etc/fluent-bit/fb-dummy.conf
    ```
    ![image](https://user-images.githubusercontent.com/330383/245838211-979ed9de-331a-48cc-9c5d-97ff9660060b.png)


    ## Generating random 10 logs per second in JSON
    We will use `Rate` configuration parameter to 10 which will create 10 logs per second. Rate at which messages are generated expressed in how many times per second. Default: 1

    ```yaml
    [INPUT]
    Name dummy
    Tag dummy.log
    Rate 10

    [OUTPUT]
    Name stdout
    Match dummy.log
    Format json_lines
    ```
    ```
    # Run script
    /opt/fluent-bit/bin/fluent-bit -c /etc/fluent-bit/fb-dummy.conf
    ```
    ![image](https://user-images.githubusercontent.com/330383/245838211-979ed9de-331a-48cc-9c5d-97ff9660060b.png)


    ## Generating custom message with dummy in fluentbit
    ```yaml
    [INPUT]
    Name dummy
    dummy {"message":"ping", "id":"app1"}
    Tag dummy.log
    Rate 1
    Copies 2

    [OUTPUT]
    Name stdout
    Match dummy.log
    Format json_lines
    ```
    ```
    # Run script
    /opt/fluent-bit/bin/fluent-bit -c /etc/fluent-bit/fb-dummy.conf
    ```
    ![image](https://user-images.githubusercontent.com/330383/245848763-a2bb23f7-3bee-4995-ae97-836e58b64061.png)

    ## Generate 10 message per second send it to Amazon OpenSearch Ingestion Service (OSI Pipeline)

    ```yaml
    [INPUT]
    Name dummy
    dummy {"message":"ping", "id":"app1"}
    Tag dummy.log
    Rate 10

    [OUTPUT]
    Name stdout
    Match dummy.log
    Format json_lines

    [OUTPUT]
    Name http
    Match dummy.log
    Host ingestion-pipeline-l4ntkea5exszl2c7vrahbbrgwe.us-east-1.osis.amazonaws.com
    Port 443
    URI /log-pipeline/test_ingestion_path
    Format json
    aws_auth true
    aws_region us-east-1
    aws_service osis
    Log_Level trace
    tls On
    ```


  9. rupeshtiwari created this gist Jun 14, 2023.
    51 changes: 51 additions & 0 deletions getting started with fluentbit.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,51 @@
    ## Single line install
    A simple installation script is provided to be used for most Linux targets. This will always install the most recent version released.
    ```
    curl https://raw.githubusercontent.com/fluent/fluent-bit/master/install.sh | sh
    ```
    This is purely a convenience helper and should always be validated prior to use. The recommended secure deployment approach is to follow the instructions below.


    ## Configure Yum
    We provide fluent-bit through a Yum repository. In order to add the repository reference to your system, please add a new file called fluent-bit.repo in /etc/yum.repos.d/ with the following content:
    Amazon Linux 2
    ```
    [fluent-bit]
    name = Fluent Bit
    baseurl = https://packages.fluentbit.io/amazonlinux/2/
    gpgcheck=1
    gpgkey=https://packages.fluentbit.io/fluentbit.key
    enabled=1
    ```
    Amazon Linux 2023
    ```
    [fluent-bit]
    name = Fluent Bit
    baseurl = https://packages.fluentbit.io/amazonlinux/2023/
    gpgcheck=1
    gpgkey=https://packages.fluentbit.io/fluentbit.key
    enabled=1
    ```
    ## Install
    Once your repository is configured, run the following command to install it:
    ```
    sudo yum install fluent-bit
    ```
    Now the following step is to instruct systemd to enable the service:
    ```
    sudo systemctl start fluent-bit
    ```
    If you do a status check, you should see a similar output like this:
    ```
    systemctl status fluent-bit
    ```
    ```
    ● fluent-bit.service - Fluent Bit
    Loaded: loaded (/usr/lib/systemd/system/fluent-bit.service; disabled; vendor preset: disabled)
    Active: active (running) since Thu 2016-07-07 02:08:01 BST; 9s ago
    Main PID: 3820 (fluent-bit)
    CGroup: /system.slice/fluent-bit.service
    └─3820 /opt/fluent-bit/bin/fluent-bit -c /etc/fluent-bit/fluent-bit.conf
    ...
    ```
    The default configuration of fluent-bit is collecting metrics of CPU usage and sending the records to the standard output, you can see the outgoing data in your /var/log/messages file.