Logstash Oracle鍚屾璁剧疆
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Logstash Oracle鍚屾璁剧疆相关的知识,希望对你有一定的参考价值。
鏍囩锛?a href='http://www.mamicode.com/so/1/nec' title='nec'>nec
鍙橀噺 鎬濇兂 and use user driver localtime 椹卞姩input {
jdbc {
#jdbc椹卞姩鍖呬綅缃? jdbc_driver_library => "D: oolselklogstash-7.6.1ojdbc8-12.2.0.1.jar"
#jdbc椹卞姩绫? jdbc_driver_class => "Java::oracle.jdbc.driver.OracleDriver"
# 鏁版嵁搴撶浉鍏抽厤缃? jdbc_connection_string => "jdbc:oracle:thin:callcard/huawei123@//callcardsitoracle01.beta.hic.cloud:1521/callcardsit_srv"
jdbc_user => "callcard"
jdbc_password => "huawei123"
# 鏄惁娓呴櫎sql_last_value鐨勮褰曪紝闇€瑕佸閲忓悓姝ユ椂姝ゅ瓧娈靛繀椤讳负false锛? clean_run => true
# 鍚屾棰戠巼(鍒?鏃?澶?鏈?骞?锛岄粯璁ゆ瘡鍒嗛挓鍚屾涓€娆★紱
schedule => "*/10 * * * * *"
use_column_value => true
tracking_column_type => timestamp
tracking_column => updated_at
# 鍚屾SQL
statement =>"select *
from user n
where updated_at>:sql_last_value and updated_at<sysdate order by updated_at desc"
# 绱㈠紩绫诲瀷锛屼笉闇€瑕佹寚瀹歵ype锛屽惁鍒欎細鍦ㄥ悓姝S鍚庣敓鎴恡ype瀛楁
#type => "user"
# 璁剧疆鏃跺尯
#jdbc_default_timezone =>"Asia/Shanghai"
}
}
filter {
# 鍒犻櫎鏃犵敤瀛楁
mutate {
remove_field => "@timestamp"
remove_field => "@version"
}
# 鏃堕棿+8涓椂鍖?鎬濇兂鏄壘涓存椂鍙橀噺锛屾渶鍚?8鍚庢浛鎹? ruby {
code => "event.set(鈥楡created_at鈥? event.get(鈥榗reated_at鈥?.time.localtime + 8*60*60)"
}
ruby {
code => "event.set(鈥榗reated_at鈥?event.get(鈥楡created_at鈥?)"
}
mutate {
remove_field => ["@created_at"]
}
}
output {
stdout {
codec => rubydebug
}
#if [type]=="user" {
elasticsearch {
# ES host:port
hosts => ["127.0.0.1:9200"]
#灏唌ysql鏁版嵁鍔犲叆blog绱㈠紩涓嬶紝浼氳嚜鍔ㄥ垱寤? index => "user"
# 鑷ID 闇€瑕佸叧鑱旂殑鏁版嵁搴撲腑鏈夋湁涓€涓猧d瀛楁锛屽搴旂储寮曠殑id鍙穇id
document_id => "%{id}"
}
# }
}
以上是关于Logstash Oracle鍚屾璁剧疆的主要内容,如果未能解决你的问题,请参考以下文章