change null value from database for one field using logstash and insert into Elasticsearch -
i replace value of field null other value. field obtained using logstash jdbc plugin database. here config file.
input { jdbc { jdbc_connection_string => "url" jdbc_user => "user" jdbc_password => "pswd" jdbc_driver_library => "./ifxjdbc-3-50-jc7.jar" jdbc_driver_class => "com.informix.jdbc.ifxdriver" statement => ["select st1.name s_name, st1.typ, st2.name comp_name, zen.s_id, zen.comp_id, zen.conc_1, zen.conc_2 sub_zen zen join sub st1 on st1.id = zen.s_id join sub st2 on st2.id = zen.comp_id"]}}
what here replace nil value (by default typ nil) p. tried far.
filter{ mutate { gsub => [ "typ", "nil", "p" ] } }
does not work.
i tried throws error
filter{ ruby { code => " if event.get('typ') == nil event.set('typ') == p end " } }
can here. how can fix this.
if field null / nil, might jdbc input not putting field in event. in case (or if can still try following) can try this:
if !("" in [typ]) { mutate { add_field => { typ => "p" } } }
Comments
Post a Comment