Service 섹션
Fluent Bit의 YAML 설정 파일에서 service 섹션이 어떤 역할을 하는지 궁금하시죠? 서비스 전체의 전역 속성을 정하는 부분이라고 생각하면 됩니다. 하나씩 옆에서 설명해 드릴게요.
출처: 문서
본문
YAML 설정 파일의 service 섹션은 Fluent Bit 서비스의 전역 속성을 정의합니다. 사용 가능한 설정 키는 다음과 같습니다:
| Key | Description | Default Value |
|---|---|---|
coro_stack_size |
Sets the coroutines stack size in bytes. The value must be greater than the page size of the running system. Setting the value too small (for example, 4096) can cause coroutine threads to overrun the stack buffer. For best results, don't change this parameter from its default value. |
24576 |
daemon |
Specifies whether Fluent Bit should run as a daemon (background process). Possible values: yes, no, on, and off. Don't enable when using a Systemd-based unit, such as the one provided in Fluent Bit packages. |
off |
dns.mode |
Sets the primary transport layer protocol used by the asynchronous DNS resolver. Can be overridden on a per-plugin basis. | UDP |
dns.prefer_ipv4 |
If enabled, the DNS resolver prefers IPv4 results when resolving hostnames. Possible values: off or on. |
off |
dns.prefer_ipv6 |
If enabled, the DNS resolver prefers IPv6 results when resolving hostnames. Possible values: off or on. |
off |
dns.resolver |
Sets the DNS resolver implementation. ASYNC uses the non-blocking resolver that runs on the Fluent Bit event loop, and LEGACY uses the blocking operating system resolver. When unset, each connection uses the resolver that matches the operating mode of the plugin making the connection. Can be overridden on a per-plugin basis. Possible values: LEGACY, ASYNC. |
none |
enable_chunk_trace |
If enabled, activates chunk tracing for debugging purposes. Requires Fluent Bit to be built with the FLB_HAVE_CHUNK_TRACE option. Possible values: off or on. |
off |
flush |
Sets the flush time in seconds.nanoseconds. The engine loop uses a flush timeout to define when to flush the records ingested by input plugins through the defined output plugins. |
1 |
flush.adaptive |
If enabled, Fluent Bit adjusts the flush interval at runtime based on chunk backpressure. See Adaptive flush intervals. Possible values: off or on. |
off |
flush.adaptive.down_steps |
Sets how many consecutive samples at a lower pressure level are required before Fluent Bit lengthens the flush interval. | 3 |
flush.adaptive.high_pressure |
Sets the chunk backpressure percentage that makes Fluent Bit target its shortest flush interval. | 75 |
flush.adaptive.low_pressure |
Sets the chunk backpressure percentage that makes Fluent Bit target its longest flush interval. | 25 |
flush.adaptive.max_interval |
Sets the upper bound in seconds for the adaptive flush interval. | 2 |
flush.adaptive.medium_pressure |
Sets the chunk backpressure percentage that makes Fluent Bit shorten the flush interval to three quarters of the flush value. |
50 |
flush.adaptive.min_interval |
Sets the lower bound in seconds for the adaptive flush interval. | 0.5 |
flush.adaptive.up_steps |
Sets how many consecutive samples at a higher pressure level are required before Fluent Bit shortens the flush interval. | 2 |
grace |
Sets the grace time in seconds as an integer value. The engine loop uses a grace timeout to define the wait time on exit. |
5 |
hc_errors_count |
Sets the number of errors that must occur within the health check period before the health check endpoint reports an unhealthy status. | 5 |
hc_period |
Sets the health check evaluation period in seconds. | 60 |
hc_retry_failure_count |
Sets the number of retry failures that must occur within the health check period before the health check endpoint reports an unhealthy status. | 5 |
health_check |
If enabled, registers a health check endpoint on the built-in HTTP server. Requires http_server to be enabled. Possible values: off or on. |
off |
hot_reload |
Enables hot reloading of configuration with SIGHUP. | on |
hot_reload.ensure_thread_safety |
If enabled, ensures thread safety during configuration hot reload. Disabling this can reduce reload time but can cause instability. Possible values: off or on. |
on |
hot_reload.timeout |
Sets a watchdog timeout in seconds for the hot reload process. If the reload doesn't complete within this time, Fluent Bit cancels the reload. A value of 0 disables the watchdog. |
0 |
http_listen |
Sets the listening interface for the HTTP Server when it's enabled. | 0.0.0.0 |
http_port |
Sets the TCP port for the HTTP server. | 2020 |
http_server |
Enables the built-in HTTP server. | off |
json.convert_nan_to_null |
If enabled, NaN is converted to null when Fluent Bit converts msgpack to JSON. |
false |
json.escape_unicode |
Controls how Fluent Bit serializes non‑ASCII / multi‑byte Unicode characters in JSON strings. When enabled, Unicode characters are escaped as \\uXXXX sequences (characters outside BMP become surrogate pairs). When disabled, Fluent Bit emits raw UTF‑8 bytes. |
true |
log_file |
Absolute path for an optional log file. By default, all logs are redirected to the standard error interface (stderr). |
none |
log_level |
Sets the logging verbosity level. Possible values: off, error, warn, info, debug, and trace. Values are cumulative. For example, if debug is set, it will include error, warning, info, and debug. The trace mode is only available if Fluent Bit was built with the FLB_TRACE option enabled. You can also set this value with the FLB_LOG_LEVEL environment variable. See Log level. |
info |
multiline_buffer_limit |
Sets the default buffer size limit for multiline parsers. This value must follow unit size specifications. | 2MB |
parsers_file |
Path for standalone parsers configuration files. You can include one or more files. | none |
plugins_file |
Path for a plugins configuration file. This file specifies the paths to external plugins (.so files) that Fluent Bit can load at runtime. Plugins can also be declared directly in the plugins section of YAML configuration files. |
none |
scheduler.base |
Sets the base of exponential backoff. | 5 |
scheduler.cap |
Sets a maximum retry time in seconds. | 2000 |
security.fips_mode |
If enabled, Fluent Bit requires the OpenSSL FIPS provider at startup and exits if it isn't available. See FIPS mode. Possible values: off or on. |
off |
sp.convert_from_str_to_num |
If enabled, the stream processor converts strings that represent numbers to a numeric type. | true |
streams_file |
Path for the stream processor configuration file. This file defines the rules and operations for stream processing in Fluent Bit. Stream processor configurations can also be defined directly in the streams section of YAML configuration files. |
none |
windows.maxstdio |
If specified, adjusts the limit of stdio. Only provided for Windows. Values from 512 to 2048 are allowed. |
512 |
service 섹션은 내장된 모니터링 및 제어용 HTTP 서버만 제어합니다. http_server.http2, http_server.buffer_max_size, http_server.buffer_chunk_size, http_server.max_connections, http_server.workers, http_server.ingress_queue_event_limit, http_server.ingress_queue_byte_limit, http_server.idle_timeout 같은 플러그인별 HTTP 리스너 설정은 관련 입력 플러그인의 pipeline.inputs 섹션에서 구성합니다.
Adaptive flush intervals
적응형 플러시 간격(Adaptive flush intervals)은 Fluent Bit 5.1 이상 버전에서 사용할 수 있어요.
flush 키는 고정된 플러시 간격을 설정합니다. 간격이 짧으면 지연 시간은 낮게 유지되지만 전달할 데이터가 적을 때 사이클을 낭비하고, 간격이 길면 파이프라인에 부하가 있을 때 전달이 지연됩니다. flush.adaptive를 활성화하면 Fluent Bit가 이 두 동작 사이를 스스로 오가게 됩니다.
flush.adaptive가 활성화되면 Fluent Bit는 모든 입력 인스턴스에서 가장 높은 청크 역압(chunk backpressure) 비율을 샘플링해 그 샘플을 압력 수준에 매핑합니다. 각 수준은 구성된 flush 값에 배율을 적용합니다:
| Backpressure sample | Flush interval |
|---|---|
flush.adaptive.high_pressure or greater |
flush multiplied by 0.5 |
flush.adaptive.medium_pressure or greater |
flush multiplied by 0.75 |
Greater than flush.adaptive.low_pressure |
flush unchanged |
flush.adaptive.low_pressure or less |
flush multiplied by 2 |
결과 간격은 flush.adaptive.min_interval과 flush.adaptive.max_interval이 정한 범위로 제한(clamp)되므로, 이 두 키가 항상 배율보다 우선합니다.
간격이 수준 사이에서 진동하는 것을 막기 위해 Fluent Bit는 수준을 바꾸기 전에 반복된 샘플을 요구합니다. 더 높은 압력 수준으로 이동하려면 flush.adaptive.up_steps개의 연속 샘플이, 더 낮은 수준으로 이동하려면 flush.adaptive.down_steps개의 연속 샘플이 필요합니다. 현재 수준과 일치하는 샘플은 카운트를 초기화합니다. Fluent Bit가 새 간격을 적용할 수 없다면 이미 적용 중인 간격을 유지합니다.
아래 예시는 정상 조건에서 1.5초마다 플러시하고, 청크 역압이 80%에 도달하면 0.75초로 줄이며, 파이프라인이 유휴 상태일 때는 최대 3초로 늦춥니다:
{% tabs %} {% tab title="fluent-bit.yaml" %}
service:
flush: 1.5
flush.adaptive: on
flush.adaptive.min_interval: 0.5
flush.adaptive.max_interval: 3
flush.adaptive.high_pressure: 80
{% endtab %} {% endtabs %}
Log level
log_level 키는 Fluent Bit가 자신에 대해 생성하는 로그의 상세 수준을 설정합니다. 같은 값을 FLB_LOG_LEVEL 환경 변수로도 설정할 수 있어요.
FLB_LOG_LEVEL은 log_level 키와 같은 값을 받습니다. 값은 대소문자를 구분하지 않으며, warning은 warn의 별칭으로 받아들여집니다.
Fluent Bit 5.1.2 이상에서는 FLB_LOG_LEVEL을 설정하면 log_level 키보다 우선합니다. 둘 다 설정해도 유효합니다. Fluent Bit는 환경 변수의 값을 적용하고 구성된 값은 무시합니다. 이렇게 하면 설정 파일을 수정하지 않고도 단일 실행에 대해 상세 수준을 높일 수 있어요:
FLB_LOG_LEVEL=debug fluent-bit --config fluent-bit.yaml
{% hint style="info" %}
Fluent Bit 5.1.0과 5.1.1 버전에서는 FLB_LOG_LEVEL과 log_level을 동시에 설정하면 could not configure service property log_level 오류로 시작이 실패합니다. Fluent Bit 5.1.2 이상에서는 올바른 우선순위를 적용합니다.
{% endhint %}
FIPS mode
FIPS 모드는 Fluent Bit 5.1 이상에서 사용할 수 있어요. 호스트에 FIPS 프로바이더가 설치된 OpenSSL 3.0 이상이 필요합니다.
security.fips_mode가 활성화되면 Fluent Bit는 시작 중에 OpenSSL FIPS 프로바이더를 활성화하고, FIPS 승인을 받은 알고리즘을 가져올 수 있는지 확인합니다. 프로바이더를 사용할 수 없거나 활성화할 수 없으면 Fluent Bit는 OpenSSL 오류를 기록하고 비준수 암호화로 시작하는 대신 종료됩니다. 같은 동작을 명령줄에서 --enable-fips 플래그로 설정할 수 있어요.
FIPS 모드는 hot reload로 변경할 수 없습니다. 재로드된 구성이 security.fips_mode를 바꾸면 Fluent Bit는 재로드를 중단하고 이전 구성으로 계속 실행됩니다.
FIPS 모드를 활성화하면 MD5에 의존하는 플러그인의 동작이 달라집니다:
- Amazon S3 출력은
send_content_md5헤더가 MD5를 필요로 하므로 시작 시 이를 거부합니다. - Azure Blob 출력은 MD5 대신 SHA-256을 사용해 블록 ID를 생성합니다.
Telemetry configuration
telemetry 키는 선택적 내부 메트릭을 제어하는 중첩 블록을 담습니다. 다른 service 키와 달리 이 설정들은 평면적인 점(dotted-key) 형태나 classic mode에 상응하는 형태가 없어요. YAML에서 중첩 맵으로 정의해야 합니다.
Count log records by tag
Fluent Bit는 각 입력이 태그별로 수집한 로그 레코드를 세어 fluentbit_input_logs_tag_records_total 메트릭으로 노출할 수 있어요. 이 기능이 만드는 메트릭에 대한 자세한 내용은 Monitoring을 참고하세요.
이 추적은 입력과 태그의 각 조합마다 메트릭 시리즈를 하나씩 만들기 때문에 메트릭 백엔드의 카디널리티를 높일 수 있어서 기본적으로 비활성화되어 있습니다.
telemetry.metrics.logs.tag_records 키의 자식으로 설정할 수 있는 키는 다음과 같습니다:
| Key | Description | Default Value |
|---|---|---|
enabled |
Enables per-tag counting of ingested log records. Individual inputs can override this value in the pipeline.inputs section. Possible values: false or true. |
false |
max_series |
Sets the maximum number of distinct input and tag combinations to track. This budget is shared across all inputs. After the limit is reached, records carrying a tag that isn't already tracked are counted in fluentbit_input_logs_tag_records_untracked_total with the reason max_series. Tags that are already tracked continue to be counted. Set to 0 or less to remove the limit. |
500 |
max_tag_length |
Sets the maximum length in bytes of a tag to track. Records with a longer tag are counted in fluentbit_input_logs_tag_records_untracked_total with the reason tag_length_limit. Longer tags are skipped rather than truncated. Set to 0 or less to remove the limit. |
128 |
max_series와 max_tag_length는 모두 service 섹션에서만 설정할 수 있어요.
이 두 제한은 각각 정수 또는 정수만 포함하는 문자열을 받습니다. 문자열은 파싱되기 전에 환경 변수로 확장되므로 ${MAX_SERIES}도 유효합니다. 결과 값은 부호 있는 32비트 정수에 들어맞아야 합니다.
Fluent Bit는 제한이 notanumber나 10abc처럼 완전한 정수가 아니거나 부호 있는 32비트 범위를 벗어나면 시작에 실패합니다. 두 제한 모두 최솟값을 강제하지는 않습니다. 0과 음수 값 모두 허용되며 오류 대신 제한을 제거합니다.
Fluent Bit는 이 블록의 알 수 없는 키도 시작 시 거부하므로, 키를 잘못 입력하면 서비스가 시작되지 않아요.
아래 예시는 태그별 카운팅을 활성화하고 두 제한을 모두 낮춥니다:
service:
flush: 1
http_server: on
telemetry:
metrics:
logs:
tag_records:
enabled: true
max_series: 200
max_tag_length: 64
Storage configuration
storage 키의 자식으로 설정할 수 있는 저장소 관련 키는 다음과 같습니다:
| Key | Description | Default Value |
|---|---|---|
storage.backlog.flush_on_shutdown |
If enabled, Fluent Bit attempts to flush all backlog filesystem chunks to their destination during the shutdown process. This can help ensure data delivery before Fluent Bit stops, but can also increase shutdown time. Possible values: off or on. |
off |
storage.backlog.mem_limit |
Sets the memory limit used by the storage_backlog input plugin when promoting backlog chunks (filesystem chunks left over from a previous Fluent Bit run) back into memory so they can be flushed by output plugins. While the up chunks owned by storage_backlog consume less memory than this limit, Fluent Bit continues to promote additional backlog chunks. This setting doesn't cap memory use for other input plugins that use filesystem storage. |
5M |
storage.checksum |
Enables data integrity check when writing and reading data from the filesystem. The storage layer uses the CRC32 algorithm. Possible values: off or on. |
off |
storage.delete_irrecoverable_chunks |
If enabled, deletes irrecoverable chunks during runtime and at startup. Possible values: off or on. |
off |
storage.inherit |
If enabled, input plugins that don't explicitly set storage.type will inherit the global storage.type value. Possible values: off or on. |
off |
storage.keep.rejected |
If enabled, the dead letter queue stores failed chunks that can't be delivered. Possible values: off or on. |
off |
storage.max_chunks_up |
Sets the number of chunks that can be up in memory for input plugins that use filesystem storage. |
128 |
storage.metrics |
If http_server option is enabled in the main service section, this option registers a new endpoint where internal metrics of the storage layer can be consumed. For more details, see Monitoring. Possible values: off or on. |
off |
storage.path |
Sets a location to store streams and chunks of data. If this parameter isn't set, input plugins can't use filesystem buffering. | none |
storage.rejected.limit |
Sets the maximum total size of the dead letter queue. Accepts size values such as 100M or 1G. When the limit is reached, new rejected chunks are skipped and a warning is logged. If not set, the DLQ size is unlimited. |
none |
storage.rejected.path |
Sets the subdirectory name under storage.path for storing rejected chunks in the dead letter queue. |
rejected |
storage.sync |
Configures the synchronization mode used to store data in the file system. Using full increases the reliability of the filesystem buffer and ensures that data is guaranteed to be synced to the filesystem even if Fluent Bit crashes. On Linux, full corresponds with the MAP_SYNC option for memory mapped files. Possible values: normal, full. |
normal |
storage.trim_files |
If enabled, Fluent Bit trims chunk files in the filesystem to reclaim disk space after data is flushed. Possible values: off or on. |
off |
storage.type |
Sets the default storage type for input plugins. Used in conjunction with storage.inherit to apply this type to all inputs that don't explicitly set their own storage.type. Possible values: memory, filesystem, memrb. |
none |
저장소와 버퍼링에 대한 자세한 내용은 Buffering과 Backpressure를 참고하세요.
스케줄러와 재시도에 대한 자세한 내용은 Scheduling and retries를 참고하세요.
Configuration example
아래 구성 예시는 hot reloading을 활성화한 service 섹션과 random 입력, stdout 출력으로 이루어진 파이프라인을 정의합니다:
service:
flush: 1
log_level: info
http_server: true
http_listen: 0.0.0.0
http_port: 2020
hot_reload: on
pipeline:
inputs:
- name: random
outputs:
- name: stdout
match: '*'