When using the jdbc_static filter and using prepared_parameters in lookup I get a "Mismatched number of placeholders" error.
The configuration looks like this:
local_lookups => [
{
id => "local-meld"
query => "SELECT nr
,meldung
FROM meld
WHERE ts_einfuegung = ?
AND system_nr = ?"
prepared_parameters => [ "[ts_einfuegung]", "[system_nr]" ]
target => "meldungen"
}
]
This is the error message:
[main] Pipeline aborted due to error {:pipeline_id=>"main", :exception=>#<Sequel::Error: Mismatched number of placeholders (2) and placeholder arguments (1) when using placeholder string>
The Logstash Version I use is the Docker container logstash:7.6.1
The jdbc_static filter verifies that the number of prepared_parameters matches the number of question marks in the query.
I would have expected the sequel library to see prepared_parameters as an array, but the error message has "when using placeholder string", so it went through this code path.
The filter does a sprintf or get on each prepared parameter. You do not have %{} around your parameters so it will be doing a get.
My guess is that the get fails, because the event is missing either a ts_einfuegung or system_nr field. If that is the case I would say it is a bug, but I am unsure whether it is a bug in the filter or a bug in the underlying library.
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.