logstash 이용 ELK 데이터 json으로 받는 방법

ELK|2022. 8. 1. 15:12
728x90

logstash conf에 아래와 같이 입력 한다. (자세한 사용 방법은 다음 기회에)

 

해당과 같이 진행 500개씩 가져온다.

input {
    elasticsearch{
        hosts => "ip:9200". #해당설정에 맞춰 진행
        index => "hanuking" #원하는 인덱스
        query => ' {"query" : { "match_all":{}}}'
        size => 500
    }
}

output{
        file { 
    codec => "json"
    path => ["C:/logstash/hanu.json"] 
    }
}

복원시 해당 입력

input {
    file {
        path => "file_path write" #백업한 파일 패스 설정
        start_position => "beginning"
        sincedb_path => "nul"
 
    }   
}    
filter{ 

  json {
    source => "message"
  }

  mutate {
    remove_field => ["path","host","@version",  "message","@timestamp"]
  }


}
output {
        elasticsearch {
                hosts => "localhost:9200" 
                index => "test"
                codec => "json_lines" 
        }

}

'ELK' 카테고리의 다른 글

Elasticsearch node 영구 제거시 명령어  (0) 2022.08.21
테스트 데이터 날짜 변경 ingest pipeline  (0) 2022.08.04
사용중인 노드 제거 방법  (0) 2022.07.28
노드롤 설정  (0) 2022.07.20
elasticsearch.yml 주요 설정  (1) 2022.07.20

댓글()