Windows (윈도우)
Fluent Bit는 Windows용 fluent-bit 패키지와 Docker Hub의 Windows 컨테이너로 배포돼요. Fluent Bit는 두 가지 Windows 설치 프로그램을 제공해요: ZIP 아카이브와 EXE 설치 프로그램이에요.
출처: 문서
본문
Fluent Bit는 Windows용 fluent-bit 패키지와 Docker Hub의 Windows 컨테이너로 배포돼요. Fluent Bit는 두 가지 Windows 설치 프로그램을 제공해요: ZIP 아카이브와 EXE 설치 프로그램이에요.
모든 플러그인이 Windows에서 지원되는 것은 아니에요. CMake 구성이 기본으로 지원되는 플러그인 집합을 보여줘요.
Configuration (설정)
설치와 함께 유효한 Windows 구성을 제공하세요.
다음 구성은 예시예요:
{% tabs %} {% tab title="fluent-bit.yaml" %}
service:
flush: 5
daemon: off
log_level: info
parsers_file: parsers.yaml
plugins_file: plugins.yaml
http_server: off
http_listen: 0.0.0.0
http_port: 2020
storage.metrics: on
pipeline:
inputs:
- name: winlog
channels: Setup,Windows Powershell
interval_sec: 1
outputs:
- name: stdout
match: '*'
{% endtab %}
{% tab title="fluent-bit.conf" %}
[SERVICE]
# Flush
# =====
# set an interval of seconds before to flush records to a destination
flush 5
# 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
[INPUT]
Name winlog
Channels Setup,Windows PowerShell
Interval_Sec 1
[OUTPUT]
name stdout
match *
{% endtab %} {% endtabs %}
Migration to Fluent Bit (Fluent Bit로 마이그레이션)
1.9 이상 버전에서 td-agent-bit는 더 이상 사용되지 않는 패키지이고 1.9.9 이후 제거됐어요. 지금 사용해야 할 올바른 패키지 이름은 fluent-bit예요.
Installation packages (설치 패키지)
최신 안정 버전은 5.1.1이에요.
이것들은 이제 Github Actions 빌드 버전을 사용해요. 레거시 AppVeyor 빌드도 releases.fluentbit.io에 여전히 있지만(AMD 32/64 전용) 더 이상 사용되지 않아요.
MSI 설치 프로그램도 사용할 수 있어요:
무결성을 확인하려면 PowerShell의 Get-FileHash cmdlet을 사용하세요.
Get-FileHash fluent-bit-5.1.1-win32.exe
Installing from a ZIP archive (ZIP 아카이브에서 설치)
-
ZIP 아카이브를 다운로드하세요. 32비트 또는 64비트 환경에 맞는 설치 프로그램을 선택하세요.
-
ZIP 아카이브를 압축 해제하세요. Explorer에서 Extract All을 클릭하거나 PowerShell에서
Expand-Archive를 사용하면 돼요.Expand-Archive fluent-bit-5.1.1-win64.zipZIP 패키지에는 다음과 같은 파일 집합이 들어 있어요.
fluent-bit ├── bin │ ├── fluent-bit.dll │ └── fluent-bit.exe │ └── fluent-bit.pdb ├── conf │ ├── fluent-bit.conf │ ├── parsers.conf │ └── plugins.conf └── include │ ├── flb_api.h │ ├── ... │ └── flb_worker.h └── fluent-bit.h -
머신에서
cmd.exe나 PowerShell을 실행하고fluent-bit.exe를 실행하세요:fluent-bit.exe -i dummy -o stdout
다음 출력은 Fluent Bit가 실행 중임을 나타내요:
fluent-bit.exe -i dummy -o stdout
...
[0] dummy.0: [1561684385.443823800, {"message"=>"dummy"}]
[1] dummy.0: [1561684386.428399000, {"message"=>"dummy"}]
[2] dummy.0: [1561684387.443641900, {"message"=>"dummy"}]
[3] dummy.0: [1561684388.441405800, {"message"=>"dummy"}]
프로세스를 중지하려면 터미널에서 Control+C를 누르세요.
Installing from the executable installer (실행 파일 설치 프로그램에서 설치)
- 적절한 32비트 또는 64비트 빌드용
EXE설치 프로그램을 다운로드하세요. - 다운로드한
EXE설치 프로그램을 더블클릭하세요. 설치 마법사가 시작돼요. - Next를 클릭하고 설치를 마치세요. 기본적으로 Fluent Bit는
C:\Program Files\fluent-bit\에 설치돼요.
& "C:\Program Files\fluent-bit\bin\fluent-bit.exe" -i dummy -o stdout
Installer options (설치 프로그램 옵션)
Windows 설치 프로그램은 CPack using NSIS로 빌드되며, 자동 설치와 설치 디렉터리에 대해 기본 NSIS 옵션을 지원해요.
C:\fluent-bit 디렉터리에 자동 설치하는 예시는 다음과 같아요:
<installer exe> /S /D=C:\fluent-bit
제거 프로그램도 같은 /S 플래그를 사용한 자동 제거를 지원해요. 이는 Ansible, Puppet 같은 자동화로 프로비저닝할 때 사용할 수 있어요.
Windows service support (Windows 서비스 지원)
Windows 서비스는 Unix의 데몬에 해당해요 (오래 실행되는 백그라운드 프로세스). v1.5.0 이상에서 Fluent Bit는 Windows 서비스를 기본적으로 지원해요.
예를 들어 다음과 같은 설치 레이아웃이 있다고 해볼게요:
C:\fluent-bit\
├── conf
│ ├── fluent-bit.conf
│ └── parsers.conf
│ └── plugins.conf
└── bin
├── fluent-bit.dll
└── fluent-bit.exe
└── fluent-bit.pdb
Fluent Bit를 Windows 서비스로 등록하려면 커맨드 프롬프트에서 다음 명령을 실행하세요. binpath= 뒤에는 공백이 하나 필요해요.
sc.exe create fluent-bit binpath= "\fluent-bit\bin\fluent-bit.exe -c \fluent-bit\conf\fluent-bit.conf"
Fluent Bit는 일반 Windows 서비스처럼 시작하고 관리할 수 있어요.
sc.exe start fluent-bit
sc.exe query fluent-bit
SERVICE_NAME: fluent-bit
TYPE : 10 WIN32_OWN_PROCESS
STATE : 4 Running
...
Fluent Bit 서비스를 중지하려면 stop 명령을 사용하세요.
sc.exe stop fluent-bit
부팅 시 Fluent Bit를 자동으로 시작하려면 다음을 실행하세요:
sc.exe config fluent-bit start= auto
FAQs
Can you manage Fluent Bit service using PowerShell? (PowerShell로 Fluent Bit 서비스를 관리할 수 있나요?)
sc.exe 대신 PowerShell로 Windows 서비스를 관리할 수 있어요.
Fluent Bit 서비스 만들기:
New-Service fluent-bit -BinaryPathName "`"C:\Program Files\fluent-bit\bin\fluent-bit.exe`" -c `"C:\Program Files\fluent-bit\conf\fluent-bit.conf`"" -StartupType Automatic -Description "This service runs Fluent Bit, a log collector that enables real-time processing and delivery of log data to centralized logging systems."
서비스 시작:
Start-Service fluent-bit
서비스 상태 조회:
get-Service fluent-bit | format-list
Name : fluent-bit
DisplayName : fluent-bit
Status : Running
DependentServices : {}
ServicesDependedOn : {}
CanPauseAndContinue : False
CanShutdown : False
CanStop : True
ServiceType : Win32OwnProcess
서비스 중지:
Stop-Service fluent-bit
서비스 제거 (PowerShell 6.0 이상 필요):
Remove-Service fluent-bit
Compile from source (소스에서 컴파일)
커스텀 실행 파일을 만들어야 한다면, 다음 절차로 Fluent Bit를 직접 컴파일하세요.
Preparation (준비)
- Fluent Bit를 컴파일하려면 Microsoft Visual C++를 설치하세요. 다음 명령으로 최소 툴킷을 설치할 수 있어요:
wget -o vs.exe https://aka.ms/vs/16/release/vs_buildtools.exe
start vs.exe
-
C++ Build Tools와C++ CMake tools for Windows를 선택하고 프로세스가 끝날 때까지 기다리세요. -
flex와 bison을 설치하세요. Windows에 설치하는 한 가지 방법은
winflexbison을 사용하는 거예요.wget -o winflexbison.zip https://github.com/lexxmark/winflexbison/releases/download/v2.5.22/win_flex_bison-2.5.22.zip Expand-Archive winflexbison.zip -Destination C:\WinFlexBison cp -Path C:\WinFlexBison\win_bison.exe C:\WinFlexBison\bison.exe cp -Path C:\WinFlexBison\win_flex.exe C:\WinFlexBison\flex.exe -
시스템 환경 변수
Path에C:\WinFlexBison경로를 추가하세요. 여기서 방법을 확인할 수 있어요. -
OpenSSL 바이너리를 설치하세요. 최소한 라이브러리 파일과 헤더가 필요해요.
-
저장소에서 소스 코드를 가져오려면 Git을 설치하세요.
wget -o git.exe https://github.com/git-for-windows/git/releases/download/v2.28.0.windows.1/Git-2.28.0-64-bit.exe start git.exe
Compilation (컴파일)
-
Windows에서 Start menu를 열고
command Prompt for VS를 입력하세요. 결과 목록에서 대상 시스템(x86또는x64)에 해당하는 것을 선택하세요. -
설치된 OpenSSL 라이브러리 파일이 선택한 대상과 일치하는지 확인하세요.
/headers옵션과 함께dumpbin명령으로 라이브러리 파일을 검사할 수 있어요. -
Fluent Bit 소스 코드를 클론하세요.
git clone https://github.com/fluent/fluent-bit cd fluent-bit/build -
소스 코드를 컴파일하세요.
cmake .. -G "NMake Makefiles" cmake --build .
이제 Fluent Bit를 실행할 수 있을 거예요:
fluent-bit.exe -i dummy -o stdout
Packaging (패키징)
ZIP 패키지를 만들려면 다음과 같이 cpack을 호출하세요:
cpack -G ZIP