zak
zak

Reputation: 71

Logstash Jdbc_streaming filter plugin returns an empty set using "parameters" option

I'm using the jdbc input plugin to get data from "table1":

statement => "SELECT * FROM table1 where id=1"
Result is : id:1 and id_subscriber:1

Then I'm using the jdbc_streaming filter plugin to get more data from "table2" using the "id_subscriber" field value from the previous statement, so I'm using the following statement which gets me an empty result :

statement => "SELECT * FROM table2 where id_subscriber = :idsub"
parameters => { "idsub" => "%{id_subscriber}"}
target => "arrayOfResults" #arrayOfResults is an empty array

If I use the id_subscribe value directly in the following statement, I get the four records I'm looking for :

statement => "SELECT * FROM table2 where id_subscriber = 1"
target => "arrayOfResults" # I get the right result

Can you tell me what Im I doing wrong ?

Thank you.

Upvotes: 0

Views: 1255

Answers (1)

zak
zak

Reputation: 71

My bad, I did not understand how the "parameters" option works. The right answer if someone came across this issue is simply :

`parameters => { "idsub" => "id_subscriber"}`

The right sided part of parameters was referring to the field name and not it's value.

Upvotes: 1

Related Questions