HELLO,
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 :
statement => "SELECT * FROM table2 where id_subscriber = :idsub"
parameters => { "idsub" => "%{id_subscriber}"}
target => "arrayOfResults" #arrayOfResults is an empty array
While the folowing statement returns 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.
This is a part of the code :
input {
jdbc {
jdbc_connection_string => 'jdbc:mysql://MYSERVER
ETC...
statement => "SELECT * FROM table1 where id=1"
}
}
filter{
jdbc_streaming
{
jdbc_connection_string => 'jdbc:mysql://MYSERVER2
ETC...
# NON WORKING STATEMENT
statement => "SELECT * FROM table2 where id_subscriber = :idsub"
# WORKING STATEMENT --> statement => "SELECT * FROM table2 where id_subscriber = 1"
parameters => { "idsub" => "%{id_subscriber}"}
target => "arrayOfResults"
}
json_encode {
source => "arrayOfResults"
target => "bar"
}
mutate {
add_field => { "arrayOfResults" => "%{bar}" }
}
}
output {
stdout { codec => json_lines }
elasticsearch {
'hosts' => 'localhost:9200'
}
}