Logstash.config not working


(Abhishek Chaturvedi) #1

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"
protocol => "http"
index => "test-migrate"
document_type => "data"
}
}

Kindly suggest what's going wrong in my configuration.


(Saafia NM) #2

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

instead of:
hosts => "http://localhost:9200"


(Saafia NM) #3

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”


(Abhishek Chaturvedi) #4

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" -d "{}"
{
"error" : {
"root_cause" : [
{
"type" : "index_not_found_exception",
"reason" : "no such index",
"resource.type" : "index_or_alias",
"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" : "test-migrate",
"index_uuid" : "na",
"index" : "test-migrate"
},
"status" : 404
}


(Saafia NM) #5

check

jdbc_user => "root"
jdbc_password => “root”

is correct?


(Abhishek Chaturvedi) #6

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

Thanks a lot..


(Saravanan) #7

output {
stdout { codec => json_lines }
elasticsearch{
hosts => ["localhost:9200"]
protocol => "http"
index => "test-migrate"
document_type => “data”
}
}


(system) #8

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