Falco에서 경고(Alert)를 파일로 저장하도록 설정하는 방법은 falco.yaml 파일을 수정하는 것입니다.

1단계: falco.yaml 파일 찾기

Falco 설정 파일은 일반적으로 다음 위치 중 하나에 있습니다.

  • /etc/falco/falco.yaml
  • /usr/local/etc/falco/falco.yaml

 

2단계: file_output 설정 활성화하기

텍스트 편집기를 사용하여 falco.yaml 파일을 열고, file_output 섹션을 찾으세요. 기본적으로 아래와 같이 enabled 값이 false로 되어 있습니다.

# [Stable] `file_output`
#
# When appending Falco alerts to a file, each new alert will be added to a new
# line. It's important to note that Falco does not perform log rotation for this
# file. If the `keep_alive` option is set to `true`, the file will be opened once
# and continuously written to, else the file will be reopened for each output
# message. Furthermore, the file will be closed and reopened if Falco receives
# the SIGUSR1 signal.
file_output:
  enabled: false
  keep_alive: false
  filename: ./events.txt

이 설정을 다음과 같이 수정하여 활성화합니다.

file_output:
  enabled: true
  keep_alive: false
  filename: /var/log/falco/events.json

수정된 부분의 의미:

  • enabled: true: 파일 출력을 활성화합니다.
  • keep_alive: true: Falco가 파일을 한 번 열고 계속 쓰도록 설정합니다. 이는 성능을 향상시키며, 많은 경고가 발생하는 환경에서 오버헤드를 줄여줍니다.(본문에서는 false 로 테스트 하였습니다)
  • filename: /var/log/falco/events.json: 경고를 저장할 파일의 경로와 이름을 지정합니다. .json 확장자를 사용하면 경고 메시지가 JSON 형식으로 저장되어 로그 분석 도구와 연동하기 쉽습니다.

3단계: Falco 재시작 또는 설정 적용하기

변경사항을 적용하려면 Falco 서비스를 재시작해야 합니다.

  • Systemd를 사용하는 경우 (대부분의 리눅스 배포판)
    sudo systemctl restart falco

 
 

+ Recent posts