One row from postgres table inserted into elasticsearch

New to Logstash, ElasticSearch etc.

Created new LogStash configuration for pulling records from Postgres DB and push to elasticsearch, however seeing only only row is pushed to elasticsearch,

input {
jdbc {
# Postgres jdbc connection string to our database, nnm
jdbc_connection_string => "jdbc:postgresql://localhost:5432/nnm"
# The user we wish to execute our statement as
jdbc_user => "postgres"
jdbc_password => "nnmP0stgr3S"
jdbc_validate_connection => true
# The path to our downloaded jdbc driver
jdbc_driver_library => "/opt/OV/nmsas/server/nms/lib/postgresql.jar"
# The name of the driver class for Postgresql
jdbc_driver_class => "org.postgresql.Driver"
schedule => "30 * * * * *"
# our query
statement => "select NMS_NODE.name,nms_node_stat.cur_stat from nms_node,nms_node_stat where nms_node.id = nms_node_stat.id;"
}
}
output {
elasticsearch {
hosts => "localhost:9200"
index => "nms_node"
document_type => "nms_node"
document_id => "%{nms_node.id}"
}
stdout { codec => rubydebug { metadata => true } }
}

Please help.

I suspect sql query is wrong or document_id is wrong.

When I run the query "select name,id from nms_node" it is giving me count of records from nms_table.

Anyone has encountered this issue, please correct me if I am wrong.

select NMS_NODE.name,nms_node_stat.cur_stat from nms_node,nms_node_stat where nms_node.id = nms_node_stat.id

You query data with specific id.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.