i have created config file in that i have coded such that for every 2mins my db is called ,it works perfectly...
and i have have column name "date(TImestamp) in db : eg:2018-07-06 11:11:19.754371",
i have to overwrite r update the value of timestamp with new timestamp..
any suggestion??
my code is:
input {
jdbc {
jdbc_connection_string => "jdbc:postgresql://localhost:5432/postgres"
jdbc_user => "postgres"
jdbc_password =>"xxx"
jdbc_driver_library => "C:\logstash-6.3.0\postgresql-42.2.2.jar"
jdbc_driver_class => "org.postgresql.Driver"
last_run_metadata_path => 'C:\xx\xx.logstash_jdbc_last_run'
record_last_run => true
jdbc_paging_enabled => "true"
jdbc_page_size => "50000"
schedule =>'*/2 * * * *'
statement => "SELECT * from contacts where date > :sql_last_value"
}
You want to update the timestamp column in the database each time Logstash has run? There's no trivial support for that, unless you perhaps can call a stored procedure that performs the update but also returns the result set of a select query.
yes..for every 2 mins it call db
[2018-07-06T18:18:00,359][INFO ][logstash.inputs.jdbc ] (0.001542s) SELECT count() AS "count" FROM (SELECT * from contacts where date > '2018-07-06 18:16:00.080000+0530') AS "t1" LIMIT 1
[2018-07-06T18:20:00,313][INFO ][logstash.inputs.jdbc ] (0.000884s) SELECT CAST(current_setting('server_version_num') AS integer) AS v
[2018-07-06T18:20:00,319][INFO ][logstash.inputs.jdbc ] (0.001579s) SELECT count() AS "count" FROM (SELECT * from contacts where date > '2018-07-06 18:18:00.353000+0530') AS "t1" LIMIT 1
[2018-07-06T18:22:00,270][INFO ][logstash.inputs.jdbc ] (0.000853s) SELECT CAST(current_setting('server_version_num') AS integer) AS v
only generation these
[2018-07-06T18:20:00,319][INFO ][logstash.inputs.jdbc ] (0.001579s) SELECT count() AS "count" FROM (SELECT * from contacts where date > '2018-07-06 18:18:00.353000+0530') AS "t1" LIMIT 1
[2018-07-06T18:22:00,270][INFO ][logstash.inputs.jdbc ] (0.000853s) SELECT CAST(current_setting('server_version_num') AS integer) AS v
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.