ELK

Logstash jdbc input sample

즐겁게살자 2021. 6. 14. 22:39
728x90

참고 : https://www.elastic.co/guide/en/logstash/current/plugins-inputs-jdbc.html

 

Jdbc input plugin | Logstash Reference [7.13] | Elastic

If not provided, Plugin will look for the driver class in the Logstash Java classpath. Additionally, if the library does not appear to be being loaded correctly via this setting, placing the relevant jar(s) in the Logstash Java classpath rather than via th

www.elastic.co

input {
  jdbc {
    jdbc_driver_class => "com.mysql.jdbc.Driver"
    jdbc_connection_string => "jdbc:mysql://xxxxxxxxx:3306"
    jdbc_user => "xxxxxxx"
    jdbc_password => "xxxxxxx"
    parameters => {"sub_minute" => "10" }
    schedule => "*/5 * * * *"
    statement_filepath => "/xxxxxx/xxxx.sql"
  }
}
  • statement_filepath : 실행 쿼리 file pathparameters : 실행 쿼리에 파라미터 전달
  • schedule : 실행 주기 cronb
input {
  jdbc {
    jdbc_driver_class => "com.mysql.jdbc.Driver"
    jdbc_connection_string => "jdbc:mysql://xxxxx:3306"
    jdbc_user => "xxxxxx"
    jdbc_password => "xxxxxxx"
    jdbc_paging_enabled => true
    jdbc_page_size => 1000
    statement_filepath => "/xxxxxx/xxxxx.sql"
  }
}
  • jdbc_paging_enabled : 쿼리 실행시 페이징 처리 여부 (default : false)
  • jdbc_page_size : 페이징 사이즈 (default : 1000)