0

我正在使用 jdbc 插件从 postgresql 数据库中获取数据,它似乎对整个导出工作正常,我能够提取数据,但它不能根据保存的状态工作,每次查询所有数据并且有很多的重复项。

我检查了 .logstash_jdbc_last_run。元数据状态会根据需要进行更新,但插件仍会在每次运行时从表中导入整个数据。如果配置有问题。

input 
{
jdbc {
jdbc_connection_string => "jdbc:postgresql://x.x.x.x:5432/dodb"
jdbc_user => "myuser"
jdbc_password => "passsword"
jdbc_validate_connection => true
jdbc_driver_library => "/opt/postgresql-9.4.1207.jar"
jdbc_driver_class => "org.postgresql.Driver"
statement => "select id,timestamp,distributed_query_id,distributed_query_task_id, "columns"->>'uid' as uid, "columns"->>'name' as name from distributed_query_result;"
schedule => "* * * * *"
use_column_value => true
tracking_column => "id"
tracking_column_type => "numeric"
clean_run => true
}
}
output
{
kafka{
topic_id => "psql-logs"
bootstrap_servers => "x.x.x.x:9092"
codec => "json"
}
}

任何帮助!在此先感谢,我使用下面的文档作为参考。 https://www.elastic.co/guide/en/logstash/current/plugins-inputs-jdbc.html

4

0 回答 0