티스토리 뷰

elastic

logstash grok filter kvpattern

shannon. 2023. 3. 15. 16:57
반응형

official doc: https://www.elastic.co/guide/en/logstash/current/plugins-filters-grok.html

 

Grok filter plugin | Logstash Reference [8.6] | Elastic

Variable substitution in the id field only supports environment variables and does not support the use of values from the secret store.

www.elastic.co

filter doc : https://www.elastic.co/guide/en/logstash/current/plugins-filters-json.html

 

JSON filter plugin | Logstash Reference [8.6] | Elastic

if the target field already exists, it will be overwritten!

www.elastic.co

KV filter : https://www.elastic.co/guide/en/logstash/current/plugins-filters-kv.html

 

Kv filter plugin | Logstash Reference [8.6] | Elastic

Variable substitution in the id field only supports environment variables and does not support the use of values from the secret store.

www.elastic.co

kv {
			  source => "msg02"
			  #field_split => ","
			  field_split_pattern => "\s|,+"
			  value_split => "="
			}

내가 처리해야할 데이터의 Key value 형식이
"blah blah a=b, c=d" 이랬다.
공백도 split 단위이고 ,콤마로도 잘라야 해서 두개 다 써야할 때는 정규식 pattern을 적용하면 된다. 우선순위도 먹음. ( \s 또는 , ) +이건 반복 이라는 뜻

그 다음은 blah blah a:b, c:d  인데,,, kv 이중적용이 가능하려나

일단 kv filter  를 적용했더니 잘 처리된다. 성능은 dissect이 더 좋은 거 같지만 난 기능이 더 중요했다. 많은 종류의 로그를 한번에 처리해야해서.

https://www.popit.kr/logstash-%ED%95%84%ED%84%B0-dissect-%EC%84%B1%EB%8A%A5-%ED%85%8C%EC%8A%A4%ED%8A%B8/

 

logstash 필터 dissect 성능 테스트 | Popit

방화벽처럼 key-value 구조가 반복되는 로그의 필드 분류에는 kv 필터 가 딱이다. 특히 구분기호로 '='을 사용하는 key-value 구조는 kv {} 구문만으로도 완벽한 테이블 구조를 만들어 줌. 문제는 kv 필터

www.popit.kr

 

반응형

'elastic' 카테고리의 다른 글

Elastic stack  (0) 2023.04.12
elasticsearch backfill, forward-fill with previous log's value  (0) 2023.04.12
elastic geo_point type의 field 만들기  (0) 2023.04.03
인덱싱 중에...  (0) 2023.03.17
make grok patterns with debugger  (0) 2023.03.10
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/07   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
글 보관함