Closed ehtishamkhan closed 6 years ago
Try the sprintf syntax instead for that field.
I.e
%{file.filename}
That didn't help. It inserted %{file.filename} as a string in the column.
input { elasticsearch { hosts => ["localhost:9200"] index => "documents" query => '{ "query": { "query_string": { "query": "*" } } }' } } output { jdbc { driver_jar_path => "" connection_string => "" statement => [ "INSERT INTO DOCUMENTCONTENT (resourceName, content) VALUES(?, ?)", "%{file.filename}", "content" ] } }
I’m that case try %{file[filename]}
or %{file['filename']}
. I’m pretty sure logstash’s sprintf function supports this but I can’t remember what syntax it uses off the top of my head.
Awesome! %{file[filename]}
works.
%{file['filename']}
inserts %{file['filename']} as a string in the target column.
input { elasticsearch { hosts => ["localhost:9200"] index => "documents" query => '{ "query": { "query_string": { "query": "*" } } }' } } output { jdbc { driver_jar_path => "" connection_string => "" statement => [ "INSERT INTO DOCUMENTS (resourceName, content) VALUES(?, ?)", "file.filename", "content" ] } }
resourceName is not populated in the target table which is an embedded property - file.filename