I checked and found that the JDBC static filter example with postgreSQL works fine.
But when I try HIVE instead of postgreSQL, it says it failed to create database.
input {
generator {
lines => [
'{"from_ip": "10.2.3.20", "app": "foobar", "amount": 32.95}',
'{"from_ip": "10.2.3.30", "app": "barfoo", "amount": 82.95}',
'{"from_ip": "10.2.3.40", "app": "bazfoo", "amount": 22.95}'
]
count => 0
}
}
filter {
json {
source => "message"
}
jdbc_static {
loaders => [
{
id => "servers"
query => "select ip, descr from local_ips order by ip"
local_table => "servers"
}
]
local_db_objects => [
{
name => "servers"
index_columns => ["ip"]
columns => [
["ip", "varchar(15)"],
["descr", "varchar(255)"]
]
}
]
local_lookups => [
{
query => "select descr as description from servers WHERE ip = :ip"
parameters => {ip => "[from_ip]"}
target => "server"
}
]
staging_directory => "/tmp/logstash/jdbc_static/import_data"
loader_schedule => "*/30 * * * *"
jdbc_user => "hive"
jdbc_password => ""
jdbc_driver_class => "org.apache.hive.jdbc.HiveDriver"
jdbc_driver_library => "/usr/share/logstash/vendor/hive-jdbc-1.2.1000.2.6.3.0-235-standalone.jar,/usr/share/logstash/vendor/hadoop-common-2.7.3.2.6.3.0-235.jar,/usr/share/logstash/vendor/hadoop-auth-2.7.3.2.6.3.0-235.jar"
jdbc_connection_string => "jdbc:hive2://ephdpm.-------.com:10000/default"
}
}
output {
file {
path => "/var/log/logstash/output.log"
codec => rubydebug {metadata => true}
}
}