Hello There,
I am referring this article https://www.elastic.co/blog/logstash-jdbc-input-plugin to ingest data from Oracle table. I need to get Oracle result set from some huge queries but before I do that I am playing with some small dataset to make sure the config is working.
What I want
- Whenever I update an existing row in DB, I also want to update my Elasticsearch document with those updates. Don't want to have a new document created with updated fields.
- Whenever I insert new row in DB, I want to get that new row in Elasticsearch.
What's not working
- I inserted 3 rows in DB to start with, so I should get 3 documents in Elasticsarch but I am getting only one.
- I inserted new row in DB but I cannot see newly inserted DB row in Elasticsearch.
What is working
- When I updated the row in DB (the similar row which I have in Elasticsearch), I can see the changes are being reflected.
I am using document_id => "%{uid}" based on above article. I do not have "uid" column in my Oracle table. The example in article does not have uid as a column in DB.
Below is my config which is running every 2 mins.
Could someone please help me to fix this?
Below is my Config
input {
jdbc {
type => "temp"
jdbc_validate_connection => true
jdbc_connection_string => “my_connection_string”
jdbc_user => “name”
jdbc_password => “pwd”
jdbc_driver_library => "opt/jdbc/lib/ojdbc7.jar"
jdbc_driver_class => "Java::oracle.jdbc.driver.OracleDriver"
jdbc_default_timezone => 'America/Chicago'
statement => "SELECT FIRSTNAME, LASTNAME, AGE, DOB, CITY, CREATED_DATE, UPDATED_DATE FROM TEST"
schedule => "*/2 * * * *"
}
}
output {
elasticsearch {
hosts => ["x.x.x.x:9200"]
manage_template => true
index => "<%{type}-{now/d}>"
document_id => "%{uid}"
}
}