# Logstash shutdown after executing command for MS SQL writing to elastic search

**URL:** <https://discuss.elastic.co/t/logstash-shutdown-after-executing-command-for-ms-sql-writing-to-elastic-search/220547>\
**Category:** Logstash\
**Created:** [February 23, 2020, 12:08pm UTC](https://discuss.elastic.co/t/logstash-shutdown-after-executing-command-for-ms-sql-writing-to-elastic-search/220547 "2020-02-23T12:08:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![yashjain](https://avatars.discourse-cdn.com/v4/letter/y/85f322/32.png) [@yashjain](https://discuss.elastic.co/u/yashjain)\
**Post date:** [February 23, 2020, 12:08pm UTC](https://discuss.elastic.co/t/logstash-shutdown-after-executing-command-for-ms-sql-writing-to-elastic-search/220547/1 "2020-02-23T12:08:28Z")

</div>

The logstash runner shutsdown after executing the index once for MS SQL writing data to elastic search db.

The conf file:

input {  
jdbc {

```
		jdbc_driver_library => "C:\MicrosoftSQLJDBCDriver\sqljdbc_4.2\enu\jre8\sqljdbc42.jar"
		jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
		jdbc_connection_string => "jdbc:sqlserver://localhost\\sqlexpress:1433;databaseName=CUSTOMER"
		jdbc_user => "sa"
		jdbc_password => "C0mplex@123"
		
		statement => "SELECT * from CUSTOMERMASTER"
		jdbc_paging_enabled => "true"
		jdbc_page_size => "50000"
		#schedule => "4 * * * *"
}

```

}

output {  
elasticsearch{  
hosts =\> ["localhost:9200"]  
index =\> "customermaster"  
}  
stdout{  
codec =\> rubydebug  
}  
}

Output:

C:\logstash-760\>bin\logstash -f mssql.conf  
Sending Logstash logs to C:/logstash-760/logs which is now configured via log4j2.properties  
[2020-02-23T00:00:46,186][WARN][logstash.config.source.multilocal] Ignoring the 'pipelines.yml' file because modules or command line options are specified  
[2020-02-23T00:00:46,404][INFO][logstash.runner] Starting Logstash {"logstash.version"=\>"7.6.0"}  
[2020-02-23T00:00:49,810][INFO][org.reflections.Reflections] Reflections took 46 ms to scan 1 urls, producing 20 keys and 40 values  
[2020-02-23T00:00:52,876][INFO][logstash.outputs.elasticsearch][main] Elasticsearch pool URLs updated {:changes=\>{:removed=\>, :added=\>[[http://localhost:9200/](http://localhost:9200/)]}}  
[2020-02-23T00:00:53,178][WARN][logstash.outputs.elasticsearch][main] Restored connection to ES instance {:url=\>"[http://localhost:9200/](http://localhost:9200/)"}  
[2020-02-23T00:00:53,249][INFO][logstash.outputs.elasticsearch][main] ES Output version determined {:es\_version=\>7}  
[2020-02-23T00:00:53,256][WARN][logstash.outputs.elasticsearch][main] Detected a 6.x and above cluster: the `type` event field won't be used to determine the document \_type {:es\_version=\>7}  
[2020-02-23T00:00:53,315][INFO][logstash.outputs.elasticsearch][main] New Elasticsearch output {:class=\>"LogStash::Outputs::ElasticSearch", :hosts=\>["[//localhost:9200](https://localhost:9200)"]}  
[2020-02-23T00:00:53,398][INFO][logstash.outputs.elasticsearch][main] Using default mapping template  
[2020-02-23T00:00:53,529][INFO][logstash.outputs.elasticsearch][main] Attempting to install template {:manage\_template=\>{"index\_patterns"=\>"logstash-_", "version"=\>60001, "settings"=\>{"index.refresh\_interval"=\>"5s", "number\_of\_shards"=\>1}, "mappings"=\>{"dynamic\_templates"=\>[{"message\_field"=\>{"path\_match"=\>"message", "match\_mapping\_type"=\>"string", "mapping"=\>{"type"=\>"text", "norms"=\>false}}}, {"string\_fields"=\>{"match"=\>"_", "match\_mapping\_type"=\>"string", "mapping"=\>{"type"=\>"text", "norms"=\>false, "fields"=\>{"keyword"=\>{"type"=\>"keyword", "ignore\_above"=\>256}}}}}], "properties"=\>{"@timestamp"=\>{"type"=\>"date"}, "@version"=\>{"type"=\>"keyword"}, "geoip"=\>{"dynamic"=\>true, "properties"=\>{"ip"=\>{"type"=\>"ip"}, "location"=\>{"type"=\>"geo\_point"}, "latitude"=\>{"type"=\>"half\_float"}, "longitude"=\>{"type"=\>"half\_float"}}}}}}}  
[2020-02-23T00:00:53,543][WARN][org.logstash.instrument.metrics.gauge.LazyDelegatingGauge][main] A gauge metric of an unknown type (org.jruby.specialized.RubyArrayOneObject) has been create for key: cluster\_uuids. This may result in invalid serialization. It is recommended to log an issue to the responsible developer/development team.  
[2020-02-23T00:00:53,580][INFO][logstash.javapipeline][main] Starting pipeline {:pipeline\_id=\>"main", "pipeline.workers"=\>4, "pipeline.batch.size"=\>125, "pipeline.batch.delay"=\>50, "pipeline.max\_inflight"=\>500, "pipeline.sources"=\>["C:/logstash-760/mssql.conf"], :thread=\>"#\<Thread:0x20c65556 run\>"}  
[2020-02-23T00:00:55,445][INFO][logstash.javapipeline][main] Pipeline started {"pipeline.id"=\>"main"}  
[2020-02-23T00:00:55,621][INFO][logstash.agent] Pipelines running {:count=\>1, :running\_pipelines=\>[:main], :non\_running\_pipelines=\>}  
[2020-02-23T00:00:56,490][INFO][logstash.agent] Successfully started Logstash API endpoint {:port=\>9600}  
[2020-02-23T00:00:57,413][INFO][logstash.inputs.jdbc][main] (0.057173s) SELECT CAST(SERVERPROPERTY('ProductVersion') AS varchar)  
[2020-02-23T00:00:57,837][INFO][logstash.inputs.jdbc][main] (0.002497s) SELECT TOP (1) count(\*) AS [COUNT] FROM (SELECT \* from CUSTOMERMASTER) AS [T1]  
[2020-02-23T00:00:57,961][INFO][logstash.inputs.jdbc][main] (0.000614s) SELECT \* FROM (SELECT \* from CUSTOMERMASTER) AS [T1] ORDER BY 1 OFFSET 0 ROWS FETCH NEXT 50000 ROWS ONLY  
C:/logstash-760/vendor/bundle/jruby/2.5.0/gems/awesome\_print-1.7.0/lib/awesome\_print/formatters/base\_formatter.rb:31: warning: constant ::Fixnum is deprecated  
{  
"phone" =\> "9833745155",  
"email" =\> "[jinalcomplex@gmail.com](mailto:jinalcomplex@gmail.com)",  
"@version" =\> "1",  
"custname" =\> "JINAL JAIN",  
"@timestamp" =\> 2020-02-22T18:30:58.016Z,  
"custid" =\> 2  
}  
{  
"phone" =\> "9833745155",  
"email" =\> "[jinalcomplex@gmail.com](mailto:jinalcomplex@gmail.com)",  
"@version" =\> "1",  
"custname" =\> "JINAL JAIN",  
"@timestamp" =\> 2020-02-22T18:30:58.015Z,  
"custid" =\> 1  
}  
{  
"phone" =\> "9004799042",  
"email" =\> "[yashcomplex@gmail.com](mailto:yashcomplex@gmail.com)",  
"@version" =\> "1",  
"custname" =\> "YASH JAIN",  
"@timestamp" =\> 2020-02-22T18:30:57.999Z,  
"custid" =\> 1  
}  
{  
"phone" =\> "9619391301",  
"email" =\> "[sagrita@gmail.com](mailto:sagrita@gmail.com)",  
"@version" =\> "1",  
"custname" =\> "SAGRITA JAIN",  
"@timestamp" =\> 2020-02-22T18:30:58.020Z,  
"custid" =\> 4  
}  
{  
"phone" =\> "9761977131",  
"email" =\> "[jrishabh@gmail.com](mailto:jrishabh@gmail.com)",  
"@version" =\> "1",  
"custname" =\> "RISHABH JAIN",  
"@timestamp" =\> 2020-02-22T18:30:58.020Z,  
"custid" =\> 5  
}  
{  
"phone" =\> "8879979896",  
"email" =\> "[shaycomplex@gmail.com](mailto:shaycomplex@gmail.com)",  
"@version" =\> "1",  
"custname" =\> "SHAY JAIN",  
"@timestamp" =\> 2020-02-22T18:30:58.018Z,  
"custid" =\> 3  
}  
[2020-02-23T00:01:00,983][INFO][logstash.runner] Logstash shut down.

Can anyone assit me whats wrong here !

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [February 23, 2020, 4:23pm UTC](https://discuss.elastic.co/t/logstash-shutdown-after-executing-command-for-ms-sql-writing-to-elastic-search/220547/2 "2020-02-23T16:23:24Z")

</div>

> [@yashjain](#):
>
> The logstash runner shutsdown after executing the index once

What do you expect it to do? You have not set a schedule option so it will execute the query once and then has nothing left to do.

---

<div class="post-metadata">

**Author:** ![yashjain](https://avatars.discourse-cdn.com/v4/letter/y/85f322/32.png) [@yashjain](https://discuss.elastic.co/u/yashjain)\
**Post date:** [February 24, 2020, 5:20am UTC](https://discuss.elastic.co/t/logstash-shutdown-after-executing-command-for-ms-sql-writing-to-elastic-search/220547/3 "2020-02-24T05:20:50Z")

</div>

If I set the schedular it is not executing even once

---

<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:** [March 23, 2020, 5:20am UTC](https://discuss.elastic.co/t/logstash-shutdown-after-executing-command-for-ms-sql-writing-to-elastic-search/220547/4 "2020-03-23T05:20:57Z")

</div>

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