# Logstash.config not working

**URL:** <https://discuss.elastic.co/t/logstash-config-not-working/95696>\
**Category:** Logstash\
**Created:** [August 3, 2017, 10:45am UTC](https://discuss.elastic.co/t/logstash-config-not-working/95696 "2017-08-03T10:45:43Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![abhishek\_chaturvedi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abhishek_chaturvedi/32/74365_2.png) [@abhishek\_chaturvedi](https://discuss.elastic.co/u/abhishek_chaturvedi)\
**Post date:** [August 3, 2017, 10:45am UTC](https://discuss.elastic.co/t/logstash-config-not-working/95696/1 "2017-08-03T10:45:44Z")

</div>

My logstash.conf file and mysql-connector-java-5.1.38.jar both are in F:\Software\logstash-5.5.1\logstash-5.5.1\bin location  
Getting below error while running conf file in cmd :  
F:\Software\logstash-5.5.1\logstash-5.5.1\bin\>logstash -f logstash.conf  
ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console.  
Sending Logstash's logs to F:/Software/logstash-5.5.1/logstash-5.5.1/logs which is now configured via log4j2.properties  
[2017-08-03T16:01:17,142][ERROR][logstash.outputs.elasticsearch] Unknown setting 'host' for elasticsearch  
[2017-08-03T16:01:17,149][ERROR][logstash.agent] Cannot create pipeline {:reason=\>"Something is wrong with your configuration."}

Below is my conf file:

# file: logstash.conf

input {  
jdbc {  
# MySql jdbc connection string to our database, testdb  
jdbc\_connection\_string =\> "jdbc:mysql://localhost:3306/testdb"  
# The user we wish to execute our statement as  
jdbc\_user =\> "root"  
jdbc\_password =\> "root"  
# The path to our downloaded jdbc driver  
jdbc\_driver\_library =\> "mysql-connector-java-5.1.38.jar"  
# The name of the driver class for Postgresql  
jdbc\_driver\_class =\> "com.mysql.jdbc.Driver"  
# our query  
statement =\> "SELECT \* from testtable"  
}  
}  
output {  
stdout { codec =\> json\_lines }  
elasticsearch{  
hosts =\> "[http://localhost:9200](http://localhost:9200)"  
protocol =\> "http"  
index =\> "test-migrate"  
document\_type =\> "data"  
}  
}

Kindly suggest what's going wrong in my configuration.

---

<div class="post-metadata">

**Author:** ![saafianihan](https://avatars.discourse-cdn.com/v4/letter/s/839c29/32.png) [@saafianihan](https://discuss.elastic.co/u/saafianihan)\
**Post date:** [August 3, 2017, 10:51am UTC](https://discuss.elastic.co/t/logstash-config-not-working/95696/2 "2017-08-03T10:51:55Z")

</div>

correct your line as :  
hosts =\> ["localhost:9200"]

instead of:  
hosts =\> "[http://localhost:9200](http://localhost:9200)"

---

<div class="post-metadata">

**Author:** ![saafianihan](https://avatars.discourse-cdn.com/v4/letter/s/839c29/32.png) [@saafianihan](https://discuss.elastic.co/u/saafianihan)\
**Post date:** [August 3, 2017, 10:56am UTC](https://discuss.elastic.co/t/logstash-config-not-working/95696/3 "2017-08-03T10:56:00Z")

</div>

do one more thing

change :  
jdbc\_driver\_library =\> “mysql-connector-java-5.1.38.jar”

as :  
jdbc\_driver\_library =\> “F:/Software/logstash-5.5.1/logstash-5.5.1/bin/mysql-connector-java-5.1.38/mysql-connector-java-5.1.38.jar”

---

<div class="post-metadata">

**Author:** ![abhishek\_chaturvedi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abhishek_chaturvedi/32/74365_2.png) [@abhishek\_chaturvedi](https://discuss.elastic.co/u/abhishek_chaturvedi)\
**Post date:** [August 3, 2017, 11:05am UTC](https://discuss.elastic.co/t/logstash-config-not-working/95696/4 "2017-08-03T11:05:17Z")

</div>

Made both the changes but getting same error.  
Also check in cURL getting below response, it means not able to run logstash.conf properly.

F:\Software\curl-7.54.1-win64-mingw\bin\>curl -XPOST "[http://localhost:9200/test-migrate/\_search?pretty=true](http://localhost:9200/test-migrate/_search?pretty=true)" -d "{}"  
{  
"error" : {  
"root\_cause" : [  
{  
"type" : "index\_not\_found\_exception",  
"reason" : "no such index",  
"resource.type" : "index\_or\_alias",  
"[resource.id](http://resource.id)" : "test-migrate",  
"index\_uuid" : "_na_",  
"index" : "test-migrate"  
}  
],  
"type" : "index\_not\_found\_exception",  
"reason" : "no such index",  
"resource.type" : "index\_or\_alias",  
"[resource.id](http://resource.id)" : "test-migrate",  
"index\_uuid" : "_na_",  
"index" : "test-migrate"  
},  
"status" : 404  
}

---

<div class="post-metadata">

**Author:** ![saafianihan](https://avatars.discourse-cdn.com/v4/letter/s/839c29/32.png) [@saafianihan](https://discuss.elastic.co/u/saafianihan)\
**Post date:** [August 4, 2017, 4:59am UTC](https://discuss.elastic.co/t/logstash-config-not-working/95696/5 "2017-08-04T04:59:38Z")

</div>

check

jdbc\_user =\> "root"  
jdbc\_password =\> “root”

is correct?

---

<div class="post-metadata">

**Author:** ![abhishek\_chaturvedi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abhishek_chaturvedi/32/74365_2.png) [@abhishek\_chaturvedi](https://discuss.elastic.co/u/abhishek_chaturvedi)\
**Post date:** [August 4, 2017, 5:13am UTC](https://discuss.elastic.co/t/logstash-config-not-working/95696/6 "2017-08-04T05:13:38Z")

</div>

Now it's working. It was a configuration problem.

Thanks a lot..

---

<div class="post-metadata">

**Author:** ![sesaravanan](https://avatars.discourse-cdn.com/v4/letter/s/ce73a5/32.png) [@sesaravanan](https://discuss.elastic.co/u/sesaravanan)\
**Post date:** [August 4, 2017, 5:30am UTC](https://discuss.elastic.co/t/logstash-config-not-working/95696/7 "2017-08-04T05:30:39Z")

</div>

output {  
stdout { codec =\> json\_lines }  
elasticsearch{  
**hosts =\> ["localhost:9200"]**  
**protocol =\> "http"**  
index =\> "test-migrate"  
document\_type =\> “data”  
}  
}

---

<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 1, 2017, 5:30am UTC](https://discuss.elastic.co/t/logstash-config-not-working/95696/8 "2017-09-01T05:30:53Z")

</div>

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