Blob 입력 플러그인
이진(binary) 파일을 모니터링하고 파이프라인으로 전달하고 싶을 때 쓰는 입력 플러그인입니다. 함께 살펴보겠습니다.
출처: 문서
본문
{% hint style="info" %}
Supported event types: logs
{% endhint %}
Blob 입력 플러그인은 디렉터리를 모니터링하고 이진(blob) 파일을 처리합니다. 지정된 경로를 주기적으로 스캔하고 이진 파일을 읽어 Fluent Bit 파이프라인을 통해 레코드로 전달합니다. 이 플러그인은 이진 로그 파일, 아티팩트, 또는 수집해서 출력으로 전달해야 하는 모든 이진 데이터를 처리합니다.
Configuration parameters
플러그인은 다음 구성 파라미터를 지원합니다:
| Key | Description | Default |
|---|---|---|
alias |
Sets an alias for multiple instances of the same input plugin. This helps when you need to run multiple blob input instances with different configurations. | none |
database_file |
Specify a database file to keep track of processed files and their state. This enables the plugin to resume processing from the last known position if Fluent Bit is restarted. | none |
exclude_pattern |
Set one or multiple shell patterns separated by commas to exclude files matching certain criteria. For example, exclude_pattern *.tmp,*.bak will exclude temporary and backup files from processing. |
none |
log_level |
Specifies the log level for this input plugin. If not set here, the plugin uses the global log level specified in the service section. Valid values: off, error, warn, info, debug, trace. |
info |
log_suppress_interval |
Suppresses log messages from this input plugin that appear similar within a specified time interval. Set to 0 to disable suppression. The value must be specified in seconds. This helps reduce log noise when the same error or warning occurs repeatedly. |
0 |
mem_buf_limit |
Set a memory buffer limit for the input plugin instance in bytes. If the limit is reached, the plugin will pause until the buffer is drained. If set to 0, the buffer limit is disabled. If the plugin has enabled filesystem buffering, this limit won't apply. The value must be according to the Unit Size specification. |
0 |
path |
Path to scan for blob (binary) files. Supports wildcards and glob patterns. For example, /var/log/binaries/*.bin or /data/artifacts/**/*.dat. This is a required parameter. |
none |
routable |
If true, the data generated by the plugin can be forwarded to other plugins or outputs. If false, the data will be discarded. This is used for testing or when you want to process data but not forward it. |
true |
scan_refresh_interval |
Set the interval time to scan for new files. The plugin periodically scans the specified path for new or modified files. The value must be specified according to the Unit Size specification (2s, 30m, 1h). |
2s |
storage.pause_on_chunks_overlimit |
Enable pausing on an input when it reaches its chunks limit. When enabled, the plugin will pause processing if the number of chunks exceeds the limit, preventing memory issues during backpressure scenarios. | false |
storage.type |
Sets the storage type for this input. Options: filesystem (persists data to disk), memory (stores data in memory only), or memrb (memory ring buffer). For production environments with high data volumes, consider using filesystem to prevent data loss during restarts. |
memory |
tag |
Set a tag for the events generated by this input plugin. Tags are used for routing records to specific outputs. Supports tag expansion with wildcards. | none |
threaded |
Indicates whether to run this input in its own thread. When enabled, the plugin runs in a separate thread, which can improve performance for I/O-bound operations. | false |
thread.ring_buffer.capacity |
Set custom ring buffer capacity when the input runs in threaded mode. This determines how many records can be buffered in the ring buffer before blocking. | 1024 |
thread.ring_buffer.window |
Set custom ring buffer window percentage for threaded inputs. This controls when the ring buffer is considered "full" and triggers backpressure handling. | 5 |
upload_failure_action |
Action to perform on the file after upload failure. Supported values: delete (delete the file), add_suffix (rename file by appending a suffix), emit_log (emit a log record with a custom message). When set to add_suffix, use upload_failure_suffix to specify the suffix. When set to emit_log, use upload_failure_message to specify the message. |
none |
upload_failure_message |
Message to emit as a log record after upload failure. Only used when upload_failure_action is set to emit_log. This can be used for debugging or monitoring purposes. |
none |
upload_failure_suffix |
Suffix to append to the filename after upload failure. Only used when upload_failure_action is set to add_suffix. For example, if set to .failed, a file named data.bin will be renamed to data.bin.failed. |
none |
upload_success_action |
Action to perform on the file after successful upload. Supported values: delete (delete the file), add_suffix (rename file by appending a suffix), emit_log (emit a log record with a custom message). When set to add_suffix, use upload_success_suffix to specify the suffix. When set to emit_log, use upload_success_message to specify the message. |
none |
upload_success_message |
Message to emit as a log record after successful upload. Only used when upload_success_action is set to emit_log. This can be used for debugging or monitoring purposes. |
none |
upload_success_suffix |
Suffix to append to the filename after successful upload. Only used when upload_success_action is set to add_suffix. For example, if set to .processed, a file named data.bin will be renamed to data.bin.processed. |
none |
어떻게 동작하나요
Blob 입력 플러그인은 지정된 디렉터리 경로에서 이진 파일을 주기적으로 스캔합니다. 새 파일이나 수정된 파일이 감지되면 플러그인은 파일 내용을 읽고 Fluent Bit 파이프라인을 통해 전달되는 레코드를 만듭니다. 이 플러그인은 데이터베이스 파일을 사용해 처리된 파일을 추적할 수 있어, 재시작 후 마지막으로 알려진 위치에서 이어서 처리할 수 있어요.
이진 파일 내용은 일반적으로 출력 레코드에 포함되며, 정확한 형식은 출력 플러그인 구성에 따라 달라집니다. 플러그인은 파일 크기와 구성에 따라 파일당 하나 이상의 레코드를 생성합니다.
데이터베이스 파일
데이터베이스 파일을 사용하면 플러그인이 어떤 파일을 처리했는지 추적하고 Fluent Bit 재시작 사이의 상태를 유지할 수 있어요. 이는 Tail 입력 플러그인이 데이터베이스 파일을 사용하는 방식과 비슷합니다.
데이터베이스 파일이 지정되면:
- 플러그인은 처리된 파일의 정보(파일 경로와 처리 상태 포함)를 저장합니다
- 재시작 시 플러그인은 이미 처리된 파일을 건너뛸 수 있습니다
- 데이터베이스는 SQLite3로 지원되며, write-ahead logging 모드를 사용하면 추가 파일(
.db-shm과.db-wal)을 생성합니다
충돌을 피하기 위해 각 blob 입력 인스턴스마다 고유한 데이터베이스 파일을 사용하는 것을 권장합니다. 예를 들어:
pipeline:
inputs:
- name: blob
path: /var/log/binaries/*.bin
database_file: /var/lib/fluent-bit/blob.db
사용 사례
Blob 입력 플러그인의 일반적인 사용 사례는 다음과 같습니다:
- 이진 로그 파일: 텍스트로 읽을 수 없는 이진 형식의 로그 파일 처리
- 아티팩트 수집: 분석이나 보관을 위한 이진 아티팩트 또는 빌드 산출물 수집
- 파일 모니터링: 새 이진 파일이 있는지 디렉터리를 모니터링하고 저장소나 분석 시스템으로 전달
- 데이터 파이프라인 통합: 이진 데이터 소스를 Fluent Bit 데이터 파이프라인에 통합
시작하기
플러그인을 명령줄에서 또는 구성 파일을 통해 실행할 수 있어요.
명령줄
다음 명령을 사용해 명령줄에서 플러그인을 실행합니다:
fluent-bit -i blob --prop "path=[SOME_PATH_TO_BINARY_FILES]" -o stdout
다음과 같은 결과가 반환됩니다:
...
[2025/11/05 17:39:32.818356000] [ info] [input:blob:blob.0] initializing
[2025/11/05 17:39:32.818362000] [ info] [input:blob:blob.0] storage_strategy='memory' (memory only)
...
구성 파일
주 구성 파일에 다음을 추가합니다:
{% tabs %} {% tab title="fluent-bit.yaml" %}
pipeline:
inputs:
- name: blob
path: '/path/to/binary/files/*.bin'
outputs:
- name: stdout
match: '*'
{% endtab %}
{% tab title="fluent-bit.conf" %}
[INPUT]
Name blob
Path /path/to/binary/files/*.bin
[OUTPUT]
Name stdout
Match *
{% endtab %} {% endtabs %}
예시
데이터베이스 추적을 사용한 기본 구성
이 예시는 처리된 파일을 추적하기 위해 데이터베이스 파일과 함께 blob 플러그인을 구성하는 방법을 보여줍니다:
{% tabs %} {% tab title="fluent-bit.yaml" %}
pipeline:
inputs:
- name: blob
path: /var/log/binaries/*.bin
database_file: /var/lib/fluent-bit/blob.db
scan_refresh_interval: 10s
tag: blob.files
outputs:
- name: stdout
match: '*'
{% endtab %}
{% tab title="fluent-bit.conf" %}
[INPUT]
Name blob
Path /var/log/binaries/*.bin
Database_File /var/lib/fluent-bit/blob.db
Scan_Refresh_Interval 10s
Tag blob.files
[OUTPUT]
Name stdout
Match *
{% endtab %} {% endtabs %}
파일 제외와 저장소가 포함된 구성
이 예시는 특정 파일 패턴을 제외하고 더 나은 신뢰성을 위해 파일시스템 저장소를 사용합니다:
{% tabs %} {% tab title="fluent-bit.yaml" %}
pipeline:
inputs:
- name: blob
path: '/data/artifacts/**/*'
exclude_pattern: '*.tmp,*.bak,*.old'
storage.type: filesystem
storage.pause_on_chunks_overlimit: true
mem_buf_limit: 50M
tag: artifacts
outputs:
- name: stdout
match: '*'
{% endtab %}
{% tab title="fluent-bit.conf" %}
[INPUT]
Name blob
Path /data/artifacts/**/*
Exclude_Pattern *.tmp,*.bak,*.old
Storage.Type filesystem
Storage.Pause_On_Chunks_Overlimit true
Mem_Buf_Limit 50M
Tag artifacts
[OUTPUT]
Name stdout
Match *
{% endtab %} {% endtabs %}
업로드 후 파일 동작이 포함된 구성
이 예시는 성공적인 업로드 후 파일 이름을 바꾸고 실패도 처리합니다:
{% tabs %} {% tab title="fluent-bit.yaml" %}
pipeline:
inputs:
- name: blob
path: /var/log/binaries/*.bin
database_file: /var/lib/fluent-bit/blob.db
upload_success_action: add_suffix
upload_success_suffix: .processed
upload_failure_action: add_suffix
upload_failure_suffix: .failed
tag: blob.data
outputs:
- name: stdout
match: '*'
{% endtab %}
{% tab title="fluent-bit.conf" %}
[INPUT]
Name blob
Path /var/log/binaries/*.bin
Database_File /var/lib/fluent-bit/blob.db
Upload_Success_Action add_suffix
Upload_Success_Suffix .processed
Upload_Failure_Action add_suffix
Upload_Failure_Suffix .failed
Tag blob.data
[OUTPUT]
Name stdout
Match *
{% endtab %} {% endtabs %}