input {
kafka {
bootstrap_servers => "localhost:9092"
topics => ["BookList","BookDuplicate"]
decorate_events => true
}
jdbc {
jdbc_connection_string => "jdbc:postgresql://127.0.0.1:5432/folio"
jdbc_user => "folio"
jdbc_password => "folio123"
jdbc_driver_library => "/Users/yanziyu/logstash/logstash-7.7.1/bin/postgresql-42.2.14.jar"
jdbc_driver_class => "org.postgresql.Driver"
jdbc_paging_enabled => "true"
jdbc_page_size => "300000"
use_column_value => "true"
tracking_column => "id"
statement => "select jsonb::TEXT from shlibrary_mod_shl_inventory.booklist_add"
schedule => "* * * * *"
type => "jdbc_booklist"
jdbc_default_timezone =>"Asia/Shanghai"
}
jdbc {
jdbc_connection_string => "jdbc:postgresql://127.0.0.1:5432/folio"
jdbc_user => "folio"
jdbc_password => "folio123"
jdbc_driver_library => "/Users/yanziyu/logstash/logstash-7.7.1/bin/postgresql-42.2.14.jar"
jdbc_driver_class => "org.postgresql.Driver"
jdbc_paging_enabled => "true"
jdbc_page_size => "300000"
use_column_value => "true"
tracking_column => "id"
statement => "select jsonb::TEXT from shlibrary_mod_shl_inventory.bookduplicate_add"
schedule => "* * * * *"
type => "jdbc_bookduplicate"
jdbc_default_timezone =>"Asia/Shanghai"
}
}
filter {
json {
source => "message"
}
mutate {
remove_field => ["@version","@timestamp"]
}
}
output {
stdout{
codec => "rubydebug"
}
if [type]== "jdbc_booklist" {
kafka {
bootstrap_servers => "localhost:9092"
topic_id => "BookList_Add"
batch_size => 5
codec => "json"
}
}
if [type]== "jdbc_bookduplicate" {
kafka {
bootstrap_servers => "localhost:9092"
topic_id => "BookDuplicate_Add"
batch_size => 5
codec => "json"
}
}
if [@metadata][kafka][topic] == "BookList" {
elasticsearch {
hosts => ["http://localhost:9200"]
index => "booklist"
document_id => "%{id}"
}
}
if [@metadata][kafka][topic] == "BookDuplicate" {
elasticsearch {
hosts => ["http://localhost:9200"]
index => "bookduplicate"
document_id => "%{id}"
}
}
}
转载请注明原文地址:https://ipadbbs.8miu.com/read-46225.html