# Problem handling null value with jdbc\_streaming filter

**URL:** <https://discuss.elastic.co/t/problem-handling-null-value-with-jdbc-streaming-filter/313538>\
**Category:** Logstash\
**Created:** [September 2, 2022, 10:20am UTC](https://discuss.elastic.co/t/problem-handling-null-value-with-jdbc-streaming-filter/313538 "2022-09-02T10:20:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kowsalya\_Mouttou](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kowsalya_mouttou/32/97648_2.png) [@Kowsalya\_Mouttou](https://discuss.elastic.co/u/Kowsalya_Mouttou)\
**Post date:** [September 2, 2022, 10:20am UTC](https://discuss.elastic.co/t/problem-handling-null-value-with-jdbc-streaming-filter/313538/1 "2022-09-02T10:20:05Z")

</div>

Hi, here is my filter plugin in logsatsh configuration :

```auto
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 ?

---

<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:** [September 30, 2022, 10:20am UTC](https://discuss.elastic.co/t/problem-handling-null-value-with-jdbc-streaming-filter/313538/2 "2022-09-30T10:20:33Z")

</div>

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