# Connecting MySql to Logstash Using JDBC

**URL:** <https://discuss.elastic.co/t/connecting-mysql-to-logstash-using-jdbc/232403>\
**Category:** Logstash\
**Created:** [May 13, 2020, 9:33am UTC](https://discuss.elastic.co/t/connecting-mysql-to-logstash-using-jdbc/232403 "2020-05-13T09:33:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jasmin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasmin/32/56586_2.png) [@Jasmin](https://discuss.elastic.co/u/Jasmin)\
**Post date:** [May 13, 2020, 9:33am UTC](https://discuss.elastic.co/t/connecting-mysql-to-logstash-using-jdbc/232403/1 "2020-05-13T09:33:04Z")

</div>

Hi ,  
this is my first time working on logstash ,  
i am trying to send data from mysql to elasticsearch using logstash ,  
but as a first step i specify json\_line output  
This is my output when running /usr/share/logstash/bin/logstash -f "/etc/logstash/logstash.conf" "--debug"  
i really don't know where is the problem , can someone help me

DEBUG] 2020-05-13 10:23:37.476 [Ruby-0-Thread-6: :1] CompiledPipeline - Compiled output  
P[output-stdout{"codec"=\>"json\_lines"}|[file]/etc/logstash/logstash.conf:12:3:```  
stdout { codec =\> json\_lines }

````auto
 into
 org.logstash.config.ir.compiler.ComputeStepSyntaxElement@c99a0cea
[DEBUG] 2020-05-13 10:23:37.475 [Ruby-0-Thread-5: :1] CompiledPipeline - Compiled output
 P[output-stdout{"codec"=>"json_lines"}|[file]/etc/logstash/logstash.conf:12:3:```
stdout { codec => json_lines }
```]
 into
 org.logstash.config.ir.compiler.ComputeStepSyntaxElement@c99a0cea
[INFO] 2020-05-13 10:23:38.113 [[main]-pipeline-manager] javapipeline - Pipeline started {"pipeline.id"=>"main"}
[DEBUG] 2020-05-13 10:23:38.132 [logstash-pipeline-flush] PeriodicFlush - Pushing flush onto pipeline.
[DEBUG] 2020-05-13 10:23:38.148 [Converge PipelineAction::Create<main>] javapipeline - Pipeline started successfully {:pipeline_id=>"main", :thread=>"#<Thread:0x375d60b sleep>"}
[INFO] 2020-05-13 10:23:38.316 [Agent thread] agent - Pipelines running {:count=>1, :running_pipelines=>[:main], :non_running_pipelines=>[]}
[DEBUG] 2020-05-13 10:23:38.408 [Api Webserver] agent - Starting puma
[DEBUG] 2020-05-13 10:23:38.425 [Api Webserver] agent - Trying to start WebServer {:port=>9600}
[DEBUG] 2020-05-13 10:23:38.598 [Api Webserver] service - [api-service] start
[INFO] 2020-05-13 10:23:39.161 [Api Webserver] agent - Successfully started Logstash API endpoint {:port=>9600}
[DEBUG] 2020-05-13 10:23:39.406 [[main]<jdbc] jdbc - loading /root/mysql-connector-java-8.0.20/mysql-connector-java-8.0.20/mysql-connector-java-8.0.20.jar
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
[INFO] 2020-05-13 10:23:40.950 [[main]<jdbc] jdbc - (0.037522s) SELECT version()
[INFO] 2020-05-13 10:23:41.024 [[main]<jdbc] jdbc - (0.001793s) SELECT version()
[INFO] 2020-05-13 10:23:41.354 [[main]<jdbc] jdbc - (0.008673s) SELECT count(*) AS `count` FROM (SELECT * FROM zen_orders) AS `t1` LIMIT 1
[INFO] 2020-05-13 10:23:41.374 [[main]<jdbc] jdbc - (0.007135s) SELECT count(*) AS `count` FROM (SELECT * FROM zen_orders) AS `t1` LIMIT 1
[DEBUG] 2020-05-13 10:23:41.377 [[main]<jdbc] jdbc - Executing JDBC query {:statement=>"SELECT * FROM zen_orders", :parameters=>{:sql_last_value=>1970-01-01 00:00:00 UTC}, :count=>23285}
[INFO] 2020-05-13 10:23:41.738 [[main]<jdbc] jdbc - (0.338735s) SELECT * FROM zen_orders
[WARN] 2020-05-13 10:23:41.836 [[main]<jdbc] jdbc - Exception when executing JDBC query {:exception=>#<Sequel::DatabaseError: Java::JavaSql::SQLException: Zero date value prohibited>}
[DEBUG] 2020-05-13 10:23:42.056 [[main]-pipeline-manager] javapipeline - Input plugins stopped! Will shutdown filter/output workers. {:pipeline_id=>"main", :thread=>"#<Thread:0x375d60b run>"}
[DEBUG] 2020-05-13 10:23:42.088 [pool-4-thread-1] jvm - collector name {:name=>"ParNew"}
[DEBUG] 2020-05-13 10:23:42.089 [pool-4-thread-1] jvm - collector name {:name=>"ConcurrentMarkSweep"}
[DEBUG] 2020-05-13 10:23:42.090 [[main]-pipeline-manager] javapipeline - Shutdown waiting for worker thread {:pipeline_id=>"main", :thread=>"#<Thread:0x5d03e81d run>"}
[DEBUG] 2020-05-13 10:23:42.144 [[main]-pipeline-manager] javapipeline - Shutdown waiting for worker thread {:pipeline_id=>"main", :thread=>"#<Thread:0x2325ffcd dead>"}
[DEBUG] 2020-05-13 10:23:42.155 [[main]-pipeline-manager] stdout - Closing {:plugin=>"LogStash::Outputs::Stdout"}
[DEBUG] 2020-05-13 10:23:42.163 [[main]-pipeline-manager] pluginmetadata - Removing metadata for plugin 29f0ba7006a5f44a67f5942509b82c32830c981b461548ba2938dade7e2b4367
[DEBUG] 2020-05-13 10:23:42.166 [[main]-pipeline-manager] javapipeline - Pipeline has been shutdown {:pipeline_id=>"main", :thread=>"#<Thread:0x375d60b run>"}
[DEBUG] 2020-05-13 10:23:42.449 [LogStash::Runner] os - Stopping
[DEBUG] 2020-05-13 10:23:42.470 [LogStash::Runner] jvm - Stopping
[DEBUG] 2020-05-13 10:23:42.472 [LogStash::Runner] persistentqueue - Stopping
[DEBUG] 2020-05-13 10:23:42.472 [LogStash::Runner] deadletterqueue - Stopping
[DEBUG] 2020-05-13 10:23:42.482 [LogStash::Runner] agent - Shutting down all pipelines {:pipelines_count=>0}
[DEBUG] 2020-05-13 10:23:42.486 [LogStash::Runner] agent - Converging pipelines state {:actions_count=>0}
[INFO] 2020-05-13 10:23:42.582 [LogStash::Runner] runner - Logstash shut down.
````

---

<div class="post-metadata">

**Author:** ![ptamba](https://avatars.discourse-cdn.com/v4/letter/p/7feea3/32.png) [@ptamba](https://discuss.elastic.co/u/ptamba)\
**Post date:** [May 13, 2020, 10:27am UTC](https://discuss.elastic.co/t/connecting-mysql-to-logstash-using-jdbc/232403/2 "2020-05-13T10:27:43Z")

</div>

> [@Jasmin](#):
>
> 0.007135s) SELECT count(\*) AS `count` FROM (SELECT \* FROM zen\_orders) AS `t1` LIMIT 1 [DEBUG] 2020-05-13 10:23:41.377 [[main]\<jdbc] jdbc - Executing JDBC query {:statement=\>"SELECT \* FROM zen\_orders", :parameters=\>{:sql\_last\_value=\>1970-01-01 00:00:00 UTC}, :count=\>23285} [INFO] 2020-05-13 10:23:41.738 [[main]\<jdbc] jdbc - (0.338735s) SELECT \* FROM zen\_orders [WARN] 2020-05-13 10:23:41.836 [[main]\<jdbc] jdbc - Exception when executing JDBC query {:exception=\>#\<Sequel::DatabaseError: Java::JavaSql::SQLException: Zero date value prohibited\>}

you have error in your sql statement. please provide your sql statement and config file to see how you’re using sql\_last\_value

---

<div class="post-metadata">

**Author:** ![Jasmin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasmin/32/56586_2.png) [@Jasmin](https://discuss.elastic.co/u/Jasmin)\
**Post date:** [May 13, 2020, 10:37am UTC](https://discuss.elastic.co/t/connecting-mysql-to-logstash-using-jdbc/232403/3 "2020-05-13T10:37:32Z")

</div>

thank you very much for your response ,  
my error was that i have in my database 0000-00-00 00:00:00 dates , i delete it , and it works 😄

---

<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 10, 2020, 10:37am UTC](https://discuss.elastic.co/t/connecting-mysql-to-logstash-using-jdbc/232403/4 "2020-06-10T10:37:34Z")

</div>

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