logstash conf 파일 안쪽에서 프로그래밍 언어 처럼 조건문을 넣어야 할 경우가 있다 그럴 경우 ruby 문법을 사용하여 넣으면 된다.

 

[ logstash conf 파일 ]

input {

    stdin {

        codec => "json"

    }   

}

 

filter {

    mutate {

        remove_field => ["host", "@timestamp", "@version"]

    }   

}              

 

output {

    if [name] == "kimjunhyeon" {

        stdout {}

    }

}

 

[ json 파일 ]

{"name": "kimjunhyeon"}

{"name": "LeeJung"}

[ 실행 ]

$ logstash -f basic_02.conf < test.json

[ 결과 ]