# Logstash how to handle null value with jdbc\_streaming

**URL:** <https://discuss.elastic.co/t/logstash-how-to-handle-null-value-with-jdbc-streaming/310533>\
**Category:** Logstash\
**Created:** [July 25, 2022, 12:09pm UTC](https://discuss.elastic.co/t/logstash-how-to-handle-null-value-with-jdbc-streaming/310533 "2022-07-25T12:09:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jsauvebois](https://avatars.discourse-cdn.com/v4/letter/j/76d3ee/32.png) [@jsauvebois](https://discuss.elastic.co/u/jsauvebois)\
**Post date:** [July 25, 2022, 12:09pm UTC](https://discuss.elastic.co/t/logstash-how-to-handle-null-value-with-jdbc-streaming/310533/1 "2022-07-25T12:09:24Z")

</div>

Hi All,

I use filter **jdbc\_streaming** because I've to extract data from two distinct database based on one column here **o\_id** (similar to **left outer join** in SQL)

```auto

input {
  jdbc{
   statement => "select col1,o_id from table 1"
  }
  ...
}
filter {
  jdbc_streaming {
    statement => "select col2col3 from table 2 where col4 = :p_id"
    parameter => {"o_id" => "p_id"}
    target => "toto"
    default_hash => {
      "col2" => ""
      "col3" => ""
    }
  }
}

mutate {
  add_fied => {
    "col2" => "%{[toto][0][col2]}"
    "col3" => "%{[toto][0][col3]}"
  }
  remove_field => ["toto"]
}

elasticsearch {
  ...
  index => "my_index"
  document_id => "%{col1}"
  ...
}

```

That means that sometimes the two **col2** and **col3** could be empty.  
Currently, when **col2** is null or empty I've **%{[toto][0][col2]}** in my document instead of **null**.

I follow this topic [How to handle empty result in jdbc\_streaming filter plugin in Logstash - #4 by naveen007](https://discuss.elastic.co/t/how-to-handle-empty-result-in-jdbc-streaming-filter-plugin-in-logstash/246347/4) but something escapes me.

I work with the stack ELK 7.0.1.  
If someone has an idea

Regards,  
Julien

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 22, 2022, 12:10pm UTC](https://discuss.elastic.co/t/logstash-how-to-handle-null-value-with-jdbc-streaming/310533/2 "2022-08-22T12:10:12Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
