카테고리 없음

Logstash 환경설정

woogy99 2025. 5. 15. 13:48

1. jar 파일 다운로드 / mysql 버전에 맞는거 설치 

https://mvnrepository.com/artifact/com.mysql/mysql-connector-j/8.0.31

 

 

2. curl for 64-bit 설치

https://curl.se/windows/

 

curl for Windows

curl 8.13.0 for Windows These are the latest and most up to date official curl binary builds for Microsoft Windows. curl version: 8.13.0 Build: 8.13.0_3 Date: 2025-04-02 Changes: 8.13.0 changelog Supported Windows versions: Vista, 7, 8, 10, 11 curl for 64-

curl.se

 

3. curl 압출 풀어서 c에 복사해놓기

 

4. mysql-connector는  logstash lib에 놓기

 

4-1. 환경변수 설정 

 

5. sample.conf 참고해서 config에 파일 만들기

 

6. 파일 내용

# Sample Logstash configuration for creating a simple
# Beats -> Logstash -> Elasticsearch pipeline.

input {
   jdbc{
jdbc_driver_library => "C:\logstash-9.0.0\lib\mysql-connector-j-8.0.31.jar"
jdbc_driver_class => "cohttp://m.mysql.jdbc.Driver"
jdbc_connection_string => "jdbc:mysql://localhost:3306/mydb?serverTimezone=UTC"
jdbc_user => "root"
jdbc_password => "happy"
statement => "SELECT * FROM board"
  }
}

output {
  elasticsearch {
    hosts => ["http://127.0.0.1:9200"]
    index => "board"
    document_type=>"_doc"
    #user => "elastic"
    #password => "changeme"
  }
}

busan.conf
0.00MB

 

 

7. elasticsearch.bat  서버 실행

 

8. cmd에서 logstash 실행

9.  확인방법. http://localhost:9200/_cat/indices?v 접속하기 

 

10. cmd에서도 확인가능 

 

ex) 테이블 확인 - http://localhost:9200/_cat/indices?v

logstash 명령어 - logstash -f c:\logstash-9.0.0\config\busan.conf

curl 명령어 
curl -X GET "http://localhost:9200/_cat/indices?v"
curl -X DELETE "http://localhost:9200/busanfood"
curl -X http://localhost:9200/busanfood/_search