2021년 7월 27일 화요일

Splunk와 Winlogbeat 차이 - 2nd

winlogbeat는 ignore_older 옵션으로 수집 시간 범위를 결정할 수 있는 반면, 스플렁크는 좀 까다롭다. current_only와 checkpointInterval 조합을 통해 수집 데이터의 시간 범위를 결정하는 건 맞는데, 좀 더 정확히 하면 

 ① 처음부터(current_only=0, 디폴트) 또는 
 ② 스플렁크 실행 이후 시점부터(current_only=1) 수집, 두 가지만 선택할 수 있다.

다음 설정(Splunk\etc\system\local\inputs.conf)을 사용하면 'current_only=0'이 디폴트이기 때문에 전체 데이터를 수집한다.
[WinEventLog://Security]
index = winevent

그런데 스플렁크가 재시작하면? 

다시 처음부터 전체 데이터를 수집한다(..) 그런 상황을 막고 싶다면 설정을 이렇게 바꿔줘야 함.
[WinEventLog://Security]
index = winevent
checkpointInterval = 5

'checkpointInterval=5'는 읽어들인 데이터 위치를 5 초 간격으로 기록한다는 의미. 당연히 시간 간격을 좁힐수록 (자원은 좀 더 쓰겠지만) 재시작 과정에서 데이터 중복 가능성은 낮아진다. 다음은 수집 데이터의 위치 정보를 기록하는 경로. 해당 경로의 파일을 지워도 데이터를 처음부터 다시 수집하게 된다.


데이터를 전부 수집할 필요가 없다면 

다음 설정을 사용하면 된다.
[WinEventLog://Security]
index = winevent
current_only = 1
checkpointInterval = 5

그런데 이 상태에서 재시작을 하면 checkpointInterval 옵션은 무시되고, 스플렁크 다운타임 동안은 데이터를 수집하지 못한다. 그래서 (이해는 잘 안되지만) 데이터 유실을 막으려면 재시작 전에 current_only 옵션값을 0으로 바꾸거나,
[WinEventLog://Security]
index = winevent
current_only = 0
checkpointInterval = 5

주석 처리를 해줘야 함. (지우거나)
[WinEventLog://Security]
index = winevent
#current_only = 1
checkpointInterval = 5

참고로 텍스트 유형의 데이터는 수집 위치에 대한 정보가 _thefishbucket 인덱스에 기록된다. 해당 인덱스를 지우면? 당연히 처음부터 다시 수집. 
[root@Centos7 splunk] bin/splunk stop
Stopping splunkd...
Shutting down.  Please wait, as this may take a few minutes.
...                                                        [  OK  ]
Stopping splunk helpers...
                                                           [  OK  ]
Done.
[root@Centos7 splunk]
[root@Centos7 splunk] bin/splunk clean eventdata -index _thefishbucket
This action will permanently erase all events from the index '_thefishbucket'; it cannot be undone.
Are you sure you want to continue [y/n]? y
Cleaning database _thefishbucket.

댓글 없음:

댓글 쓰기

크리에이티브 커먼즈 라이선스