Hi, here is my filter plugin in logsatsh configuration :
filter {
jdbc_streaming {
jdbc_driver_library => "/usr/share/logstash/logstash-core/lib/jars/postgresql-42.2.6.jar"
jdbc_driver_class => "org.postgresql.Driver"
jdbc_connection_string => "jdbc:postgresql://*******/***"
jdbc_user => "*****"
jdbc_password => "****"
statement => "SELECT dir.libelledir, dir.datedebut, dir.codedeleg, deleg.libelledeleg FROM gaia2stat.t_direction AS dir, gaia2stat.t_delegation AS deleg
WHERE dir.codedir = :codedir_param AND dir.codedeleg = deleg.codedeleg "
parameters => { "codedir_param" => "codedir"}
target => "dir_deleg"
default_hash => {
"libelledir" => ""
"datedebut" => ""
"codedeleg" => ""
"libelledeleg" => ""
}
add_field => {
"libelledir" => "%{[dir_deleg][0][libelledir]}"
"datedebut" => "%{[dir_deleg][0][datedebut]}"
"codedeleg" => "%{[dir_deleg][0][codedeleg]}"
"libelledeleg" => "%{[dir_deleg][0][libelledeleg]}"
}
#remove_field => ["dir_deleg"]
}
Even after setting the default_hash option, i have problem handling null values in the "datedebut" field.
I've %{[dir_deleg][0][datedebut]}
in some of my documents instead of "" for the "datedebut" field.
Can anyone please help me solving this issue ?