운영체제 : window7
1.Logstash다운로드
> https://www.elastic.co/downloads/logstash
2.CONF 파일 생성
2-1 1. 에서 다운 받은 ZIP을 원하는 디렉토리에 압축 해제 하여 CONF 파일을 생성 하기전 아래와 같이 CMD 에서 실행 해본다
(바로 2-2로 가도 상관 없음.)
>> bin\logstash.bat -e 'input { stdin {} } output { stdout {} }'
2-2 CONF파일 생성 후 실행
BIN 폴더와 같은 디렉토리에 아래와 같이 CONF 파일을 설정 한다
input {
stdin {
codec => json
}
file {
path => "B:/***/2017-09-18.log" # 해당 위치의 파일이 변경 되면 엘라스틱 엔진에 데이터를 넣는다
}
}
output {
elasticsearch {
# host => "localhost"
index => "log" # LOG 인덱스가 없을 경우 생성 하여 해당 인덱스에 넣어준다
# index_type => "article"
# protocol => "http"
hosts => ["localhost:9200"]
}
stdout {
codec => json { }
}
file {
path => "B:/STUDY/Java/logstash-5.6.0/logs/WebLog/webLog.log"
codec => json { }
}
}
2-3 cmd 에서 bin\logstash.bat -f logstash.conf 때린다
오류없이 정상 처리 되면 성공
3.테스트
3-1. B:/***/2017-09-18.log 파일을 열어 테스트 데이터를 넣어 정상적으로 넣어지는지 확인한다
{"document_srl":1, "subject":"first", "content":"first_content", "account":"first_acc", "reg_date":"2017-08-21"}
{"BOLLOG":1, "subject":"first", "content":"first_content", "account":"first_acc", "reg_date":"2017-08-21"}
{"BOLLOG":2, "subject":"first1", "content":"first_content", "account":"first_acc", "reg_date":"2017-08-21"}
3-2. 키바나에서 아래와 같이 넣어진 데이터를 확인 할 수 있다
해당 로그 파일데이터가 바뀔 때 마다 cmd에 로그가 찍힌다
3-3 넣은 데이터를 키바나 말고 웹브라우져 에서 확인 하기
>> http://localhost:9200/log/logs/AV6ZIqaHpVuiGdVMgWnQ
'검색엔진' 카테고리의 다른 글
6.[Elasticsearch] 용어 정리 (0) | 2017.09.20 |
---|---|
5.[Elasticsearch] KIBANA로 데이터 조회 및 넣기 (0) | 2017.09.19 |
3.[Elasticsearch] kibana 다운로드 하기 (0) | 2017.09.05 |
2.[Elasticsearch] 데이터 넣기 (0) | 2017.08.31 |
1. 엘라스틱서치 설치 (0) | 2016.10.19 |