# Problem with jdbc\_streaming

**URL:** <https://discuss.elastic.co/t/problem-with-jdbc-streaming/86622>\
**Category:** Logstash\
**Created:** [May 22, 2017, 8:16am UTC](https://discuss.elastic.co/t/problem-with-jdbc-streaming/86622 "2017-05-22T08:16:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nano](https://avatars.discourse-cdn.com/v4/letter/n/dec6dc/32.png) [@nano](https://discuss.elastic.co/u/nano)\
**Post date:** [May 22, 2017, 8:16am UTC](https://discuss.elastic.co/t/problem-with-jdbc-streaming/86622/1 "2017-05-22T08:16:41Z")

</div>

Good morning,

please i have some quetions about jdbc\_streaming , i made such a configuration to extract some data using jdbc\_streaming but i didn't acheive to my goal .

there is my configuration file  
jdbc\_streaming {  
jdbc\_driver\_library =\> ".............."  
jdbc\_driver\_class =\> "................."  
jdbc\_connection\_string =\> "............."  
jdbc\_user =\> "........"  
jdbc\_password =\> "........"  
parameters =\> {"variable"=\>"field2"}  
statement =\> "SELECT field5 From database2 where field4 =:variable"

target =\> "code"  
use\_cache =\> "true"  
cache\_expiration =\> "5"  
cache\_size =\> "100"

}  
when i run logstash on mode debug i have code=\>[field5=\>"valueoffield5"]

but what i want is added code to first database with value directly not code=\>[field5=\>"valueoffield5"]

Please need some help

---

<div class="post-metadata">

**Author:** ![Vittorio](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vittorio/32/18171_2.png) [@Vittorio](https://discuss.elastic.co/u/Vittorio)\
**Post date:** [May 22, 2017, 2:33pm UTC](https://discuss.elastic.co/t/problem-with-jdbc-streaming/86622/3 "2017-05-22T14:33:11Z")

</div>

would you please put an example log you expect?

If your problem is just that the field you want is nested for example:

```
{
          "svc" : "example",
          "user_agent" : "/1.1/iOS/10.1.1/iPhone MDL",
          "ts" : "2017-05-08T15:15:21.612+02:00",
          "code" :{
              "field5":"valueoffield5"
          }    
 }

```

but you simply want :  
`{"code":"valueoffield5"}`

then I think you could use the `alter`filter that uses the `coalesce` function.

```
alter {
        coalesce => [
             "code", "%{[code][field5]}"]
      }

```

that will create the field you want with the value you want. Then you just remove the old one. It is not a pretty solution but I think it should work IF I understood correctly your problem...

---

<div class="post-metadata">

**Author:** ![nano](https://avatars.discourse-cdn.com/v4/letter/n/dec6dc/32.png) [@nano](https://discuss.elastic.co/u/nano)\
**Post date:** [May 22, 2017, 2:50pm UTC](https://discuss.elastic.co/t/problem-with-jdbc-streaming/86622/5 "2017-05-22T14:50:00Z")

</div>

hello! thank you for your reply  
this is how look my configuration file:  
jdbc\_streaming  
{

```
    jdbc_driver_library =>                                                                                               
    jdbc_driver_class =>                                                                                                                           
    jdbc_connection_string =>                                                                                                             
    jdbc_user => ""                                                                                                                                                     
    jdbc_password => ""                                                                                                                                                 
    statement => "SELECT field5 From database2 where field2 = variable"         
    parameters => {"variable"=>"field2"}                                                                                                                       
    target => "code"                                                                                                                                              

```

}

field2 is from database1 that i extract already

actually when i run logstash without mode debug i have nothing in output, and when i run on mode debug i have  
{"event"=\>{"code"=\>["field5":"valueoffield5"] } as you said  
and i haven't any output in elasticsearch

---

<div class="post-metadata">

**Author:** ![Vittorio](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vittorio/32/18171_2.png) [@Vittorio](https://discuss.elastic.co/u/Vittorio)\
**Post date:** [May 22, 2017, 2:59pm UTC](https://discuss.elastic.co/t/problem-with-jdbc-streaming/86622/6 "2017-05-22T14:59:27Z")

</div>

I suggest you to use `stdout{codec=> rubydebug}` as output so you can test the log you are sending to whatever output you need.

I think I didn't really understand your problem then, your log has been enriched? Your problem is in the ouput filter?

As I said, put a complete configuration example you are using, put an example log you want.

---

<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:** [June 20, 2017, 9:34am UTC](https://discuss.elastic.co/t/problem-with-jdbc-streaming/86622/10 "2017-06-20T09:34:46Z")

</div>

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