헬스 (Health)
지원 이벤트 유형:
logs
Health 입력 플러그인은 TCP 서버가 얼마나 건강한지 확인할 수 있게 해 줘요. 정기적인 간격으로 TCP 연결을 시도해서 확인해요.
출처: 문서
본문
구성 파라미터
이 플러그인은 다음 구성 파라미터를 지원해요.
| Key | Description | Default |
|---|---|---|
add_host |
If enabled, hostname is appended to each record. | false |
add_port |
If enabled, port number is appended to each record. | false |
alert |
If enabled, it generates messages only when the target TCP service is down. | false |
host |
Name of the target host or IP address. | none |
interval_nsec |
Specify a nanoseconds interval for service checks. Works with the interval_sec configuration key. |
0 |
interval_sec |
Interval in seconds between the service checks. | 1 |
port |
TCP port where to perform the connection request. | none |
threaded |
Indicates whether to run this input in its own thread. | false |
시작하기 (Get started)
체크를 시작하려면 명령줄에서 또는 설정 파일을 통해 플러그인을 실행할 수 있어요.
명령줄
명령줄에서 Fluent Bit에 다음과 같은 옵션으로 체크를 생성하게 할 수 있어요.
fluent-bit -i health -p host=127.0.0.1 -p port=80 -o stdout
설정 파일
메인 설정 파일에 다음을 추가해요.
fluent-bit.yaml:
pipeline:
inputs:
- name: health
host: 127.0.0.1
port: 80
interval_sec: 1
interval_nsec: 0
outputs:
- name: stdout
match: '*'
fluent-bit.conf:
[INPUT]
Name health
Host 127.0.0.1
Port 80
Interval_Sec 1
Interval_Nsec 0
[OUTPUT]
Name stdout
Match *
테스트 (Testing)
Fluent Bit가 실행되면 출력 인터페이스에서 다음과 같은 헬스 체크 결과를 볼 수 있어요.
$ fluent-bit -i health -p host=127.0.0.1 -p port=80 -o stdout
...
[0] health.0: [1624145988.305640385, {"alive"=>true}]
[1] health.0: [1624145989.305575360, {"alive"=>true}]
[2] health.0: [1624145990.306498573, {"alive"=>true}]
[3] health.0: [1624145991.305595498, {"alive"=>true}]
...