logstash 를 여러개 실행 하는 것

 

conf 파일을 서로 다른 디렉토리에 두고, logstash.yml의 path.data를 수정해야 한다. 

startup.options 에서 LS_SETTING_DIR 을 conf가 있는 경로로 수정해 준다 

 

보통 실행할 때 $logstash_home_dir/bin/logstash -f temp.conf 로 실행하는데, 

$logstash_home_dir/bin/logstash --path.settings ./temp_conf_0 -f ./temp_conf_0 /temp1.conf

$logstash_home_dir/bin/logstash --path.settings ./temp_conf_1 -f ./temp_conf_1 /temp2.conf 

$logstash_home_dir/bin/logstash --path.settings ./temp_conf_2 -f ./temp_conf_2 /temp3.conf 

 

--path.settings 옆에 conf가 있는 디렉토리 경로를 적어주고, 그 뒤에 conf 파일명을 적어준다.

 

위 처럼 하면 conf 파일 3개가 동시에 수행된다. 

728x90

'일상 > Today I Learn(TIL)' 카테고리의 다른 글

2019-08-13 TIL pandas DataFrame 다루기  (0) 2019.08.13
2019-07-31 TIL Elastic Search  (0) 2019.07.31
2019-07-22 TIL logstash  (0) 2019.07.24
2019-07-21 TIL '쇠막대기' 알고리즘 문제풀이  (0) 2019.07.21
Today I Learn 시작  (0) 2019.07.21

logstash가 실행하는 conf 파일을 작성 

 

temp.conf 로 저장하고

$logstash_home_dir/bin/logstash -f temp.conf 로 실행한다 

 

filter에는 조건을 주는데, mutate 부분은 이상한 컬럼이 들어갈 수 있기 때문에 이를 방지하기 위해 반드시 써줘야 한다. 

input {
        file {
                path => "/home/file.txt"
                start_position => "beginning"
                sincedb_path => "/dev/null"
        }
}

filter {
        csv{
                separator => ","
                columns => ["col1", "col2", "col3"]
        }
        mutate {
                remove_field => ["message", "host", "path", "@timestamp", "@version"]
        }
}

output {
        elasticsearch {
                hosts => "http://address:port"
                index => "index_name"
                document_id => "%{[col1]}"
        }
        stdout {}
}
728x90

+ Recent posts