본문 바로가기
개발

ELK logstash.conf - filter 주의사항

by meanjung 2021. 8. 13.

logstash.conf

input - filter - output

 

1. json

 

filter {
      json {
             source => "message"
       }
}

☞ json parsing 을 하기 위한 field 를 지정하게 된다. 즉, message 필드를 json으로 파싱한다는 의미

 

아래 로그가 필드가 더 많은 걸 알 수 있다.

 

 

2. mutate

 

특정 필드 가공

- add_field

- remove_field -> @timestamp, _id, _type, _index 제거 안 됨

host.keyword와 host가 동시에 있는데, host.keyword 제거 안 됨. host 제거하면 하위 모든 것 삭제됨

keyword는 mapping에서 text type이기 때문에 자동 생성됨. 이미 생성된 index는 mapping을 수정할 수 없음

 


Todo.

에이전트에서 오는 로그와 웹 서버에서 오는 로그를 구분해 다른 index 주기

 

 

 

댓글