2025년 10월 1일 수요일

Splunk의 필드 처리 순서 - 2nd

스플렁크는 9단계의 필드 처리 순서를 갖는데, 그중 KV_MODE 옵션을 사용하는 3단계는 key=value 구조의 데이터를 자동으로 field=value 구조로 바꿔준다.

Search-time operation order Operation name Configurable in Splunk Web? Location of file configuration
1 Inline field extraction (no field transform) Yes EXTRACT-<class>  in a stanza in the  props.conf  file.
2 Field extraction that uses a field transform Yes REPORT-<class>  in a stanza in the  props.conf  file.
3 Automatic key-value field extraction No In stanzas in the  props.conf  file, where  KV_MODE  is set to a valid value other than  none . If no  KV_MODE  value is specified for a stanza, it is set to  auto  by default.
4 Field filters Yes fieldFilterName  stanza in the  field_filters.conf  file.
5 Field aliasing Yes FIELDALIAS-<class>  in a stanza in the  props.conf  file.
6 Calculated fields Yes EVAL-<fieldname>  in a stanza in the  props.conf  file.
7 Lookups Yes LOOKUP-<class>  in a stanza in the  props.conf  file.
8 Event types Yes In a stanza in the  eventtypes.conf  file.
9 Tags Yes In a stanza in the  tags.conf  file.
전체 데이터가 일관된 key=value 구조라면 매우 유용한 기능. 하지만 다른 구조가 섞여 있다면 골치 아파질 수 있다. 일단 스플렁크는 props.conf와 transforms.conf를 사용하는 필드 처리 2단계에서 아파치 웹로그 전처리 작업을 진행한다.


url 데이터에서 경로 정보를 제거한 file 필드가 이 과정에서 만들어지는데, 순서대로면 3단계 file 필드가 2단계 file 필드를 덮어써야 한다. 그런데 2단계 필드가 없을 때만 덮어씀. 필드 이름이 같으면 높은 단계의 처리 결과가 최종 적용되는 게 정상인데, 아닐 때도 있는 듯(..)


웹로그 변수는 서비스 구조 등에 따라 다양한 변화가 가능하기 때문에 (개발 담당자 아니면) 전체 현황 파악이 어렵다. 내가 모르는 테이블 구조가 만들어지기 때문에 일관된 스키마를 유지하기 힘들고, 필드 충돌 상황이 발생할 수 있다는 얘기. 단일 구조(key=value)를 갖는 데이터가 아니면 KV_MODE 옵션은 쓰지 말아야겠다.

댓글 없음:

댓글 쓰기

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