[Filebeats] filebeats input filestream 에서 id 설정의 중요성

Elastic/Beats 2022. 8. 12. 18:20

filebeats input filesstream 에서 id 설정을 하고 사용 하시길 권장 합니다.

 

코드를 한번 보실 분들은 아래 파일 열어 보시면 됩니다.

filebeat/input/filestream/
  ㄴ filestream.go
  ㄴ input.go

filebeat input 에서는 inode marker 를 이용해서 file offset 에 대한 처리 정보를 기록 합니다.
이를 통해서 데이터를 처리 하게 되는데 여러개의 filestream 을 등록 하게 되면 같은 파일에 대해서 데이터를 중복으로 처리 하거나 우선순위에 따라 먼저 선점한 filestream 이와 다른 filestream 에서 처리가 안되는 경우가 발생 할 수 있습니다.
이를 해결 하기 위해서는 사전에 등록된 file 의 inode marker 를 리셋 하거나 filestream 설정에서 id 지정을 통해서 해결 할 수 있습니다.

 

참고문서)
https://www.elastic.co/guide/en/beats/filebeat/8.3/filebeat-input-filestream.html
https://www.elastic.co/guide/en/beats/filebeat/8.3/filebeat-input-filestream.html#filestream-input-id

 

Each filestream input must have a unique ID. Omitting or changing the filestream ID may cause data duplication. Without a unique ID, filestream is unable to correctly track the state of files.

Changing input ID may cause data duplication becauin the state of the files will be lost and they will be read from the beginning again.

id 값은 유니크 해야 하고 변경 시 데이터가 중복 발생 할 수 있다는 내용입니다.
실제 설정에서 id 설정을 하지 않더라도 실행에는 문제가 되지 않습니다.

: