본문 바로가기

리눅스

우분투에 플루언트 비트를 설치하고 기본 설정하는 방법(Fluent Bit)

728x90

우분투에 플루언트 비트를 설치하고 기본 설정하는 방법(Fluent Bit)

플루언트 비트(Fluent Bit)는 경량 로그 전송 및 처리 도구로, 로그 수집, 필터링 및 전송을 위한 효율적인 솔루션입니다.

1. 플루언트 비트 설치

  • 설치 스크립트
curl -fsSL https://raw.githubusercontent.com/fluent/fluent-bit/master/install.sh | sh
  • APT 패키지 설치
curl -fsSL https://packages.fluentbit.io/fluentbit.key | gpg --dearmor > /usr/share/keyrings/fluentbit-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/fluentbit-keyring.gpg] \
https://packages.fluentbit.io/ubuntu/`lsb_release -cs` `lsb_release -cs` main" \
| sudo tee /etc/apt/sources.list.d/fluentbit.list
sudo apt-get update
sudo apt-get install -y fluent-bit

2. 플루언트 비트 설정 파일 생성

더보기

---

$ cat /etc/fluent-bit/fluent-bit.conf
[SERVICE]
    # Flush
    # =====
    # set an interval of seconds before to flush records to a destination
    flush        1

    # Daemon
    # ======
    # instruct Fluent Bit to run in foreground or background mode.
    daemon       Off

    # Log_Level
    # =========
    # Set the verbosity level of the service, values can be:
    #
    # - error
    # - warning
    # - info
    # - debug
    # - trace
    #
    # by default 'info' is set, that means it includes 'error' and 'warning'.
    log_level    info

    # Parsers File
    # ============
    # specify an optional 'Parsers' configuration file
    parsers_file parsers.conf

    # Plugins File
    # ============
    # specify an optional 'Plugins' configuration file to load external plugins.
    plugins_file plugins.conf

    # HTTP Server
    # ===========
    # Enable/Disable the built-in HTTP Server for metrics
    http_server  Off
    http_listen  0.0.0.0
    http_port    2020

    # Storage
    # =======
    # Fluent Bit can use memory and filesystem buffering based mechanisms
    #
    # - https://docs.fluentbit.io/manual/administration/buffering-and-storage
    #
    # storage metrics
    # ---------------
    # publish storage pipeline metrics in '/api/v1/storage'. The metrics are
    # exported only if the 'http_server' option is enabled.
    #
    storage.metrics on

    # storage.path
    # ------------
    # absolute file system path to store filesystem data buffers (chunks).
    #
    # storage.path /tmp/storage

    # storage.sync
    # ------------
    # configure the synchronization mode used to store the data into the
    # filesystem. It can take the values normal or full.
    #
    # storage.sync normal

    # storage.checksum
    # ----------------
    # enable the data integrity check when writing and reading data from the
    # filesystem. The storage layer uses the CRC32 algorithm.
    #
    # storage.checksum off

    # storage.backlog.mem_limit
    # -------------------------
    # if storage.path is set, Fluent Bit will look for data chunks that were
    # not delivered and are still in the storage layer, these are called
    # backlog data. This option configure a hint of maximum value of memory
    # to use when processing these records.
    #
    # storage.backlog.mem_limit 5M

[INPUT]
    name cpu
    tag  cpu.local

    # Read interval (sec) Default: 1
    interval_sec 1

[OUTPUT]
    name  stdout
    match *

---

sudo vim /etc/fluent-bit/fluent-bit.conf

3. 구성 파일에 오류가 있는지 확인

sudo /opt/fluent-bit/bin/fluent-bit -c /etc/fluent-bit/fluent-bit.conf --dry-run

fluent-bit_syntax_check

4. 플루언트 비트 실행/재실행/정지

sudo systemctl start fluent-bit
sudo systemctl restart fluent-bit
sudo systemctl stop fluent-bit

5. 플루언트 비트 상태 확인

sudo systemctl status fluent-bit

6. 로그 확인

sudo tail -f /var/log/fluent-bit/fluent-bit.log

 

참고URL

- Fluent Bit Documentation : ubuntu

 

728x90