Hello everyone!
I have a problem with configuring the logstash 5.2.
I use jdbc-input plugin, And I want to put the result of the SQL-query in to the one field called "query_result". But I don't know how. Can you help me?
The jdbc input does not allow this. If you really need this you will need to modify a fork of the library and run with that.
I can help with the code that needs to change - its a few extra characters in one line. That is the easy bit. The harder bits are knowing what to do in github and getting Logstash to install your fork.
Alternatively you can use the ruby filter to stitch back the keys and values - performance will go down and the ruby code is a bit tricky especially because it needs to written as a one liner.
How good is your Github knowledge and Ruby coding skills?
Thanks for the answer.
In my opinion, the first variant with own fork of the jdbc plugin is hard. It required always updgrading fork of plugin jdbc when logstash is updating. Unfortunately, I'm not good in Ruby. I don't think that I can resolve this problem myself.
Maybe, there is a solution with standart logstash features. For example, I can send jdbc generated event to logstash pipeline again. Then jdbc generated event will be nested in field "message". Then I can rename field "message" to field "result_query" by mutate filter. Or maybe there's a simpler solution.
I can't see that working. The jdbc input will create an event from each row, in the event each column name will be a key and the column value will be a value in the event at the root level.
It will be hard to know what the collection of column names are outside of the jdbc input code.
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.