Oracle DB:11.2.0.4 OJDBC版本:ojdbc6.jar JDK:openjdk 1.8 LogStash版本:6.3.2-1 我在logstash错误日志[ERROR] [logstash.inputs.jdbc]中收到以下错误,无法连接到数据库。尝试了1次{:error_message =>“ Java :: JavaSql :: SQLException:ORA-00604:在递归SQL级别1发生错误\ nORA-01882:找不到时区区域\ n”} Logstash代码:
input{
jdbc{
# jdbc_default_timezone => "Asia/Kolkata"
jdbc_driver_library => "/var/lib/logstash/OJDBC-Full/ojdbc6.jar"
jdbc_driver_class => "Java::oracle.jdbc.driver.OracleDriver"
jdbc_connection_string => "jdbc:oracle:thin:@xxxx:port:sid"
jdbc_user => "xxxx"
jdbc_password => "xxxx"
jdbc_validate_connection => true
statement => "select count(*) from apps.icx_sessions icx join apps.fnd_user usr on usr.user_id=icx.user_id left join apps.fnd_responsibility resp on resp.responsibility_id=icx.responsibility_id where last_connect>sysdate-nvl(FND_PROFILE.VALUE('ICX_SESSION_TIMEOUT'),30)/60/24 and disabled_flag != 'Y' and pseudo_flag = 'N' and USER_NAME <> 'GUEST'"
type => "xxx_RPT_DB_Session_query"
schedule => "*/2 * * * *"
}
}
filter{
}
output{
file{
path => "/var/log/logstash/sample-JDBC-%{+YYYY-MM-dd}.txt"
}
elasticsearch{
hosts => ["xxxxxxxxx:7778"]
index => "q_session"
}
http{
format => "json"
http_method => "post"
url => "https://api.telegram.org/bot629711229:AAFDebywi4NDiSdqqHhmxTFlUH7cMUJwwvE/sendMessage"
mapping => {
"chat_id" => "xxxxx"
"parse_mode" => "html"
"text" => "❗ Current Session Count 😱"
}
}
}
答案 0 :(得分:0)
遇到同样的问题,解决了它在logstash jvm.options中添加一行
-Duser.timezone="+01:00"
当然,您必须更改时区的+01