user2144684
user2144684

Reputation: 103

Unknown setting ‘host’ for elasticsearch in logstash conf

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:

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 => "F:/Software/logstash-5.5.1/logstash-5.5.1/bin/mysql-connector-java-5.1.38/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 => ["localhost:9200"]
 protocol => "http" 
 index => "test-migrate"
 document_type => "data"
}

}

Upvotes: 0

Views: 2470

Answers (1)

Gobinda Nandi
Gobinda Nandi

Reputation: 515

This is standard and basic conf file

Good luck !!!!

input {
    jdbc {
        jdbc_driver_library => "/mysql-connector-java-5.1.44-bin.jar"
        jdbc_driver_class => "com.mysql.jdbc.Driver"
        jdbc_connection_string => "jdbc:mysql://localhost:3306/yourdatabase"
        jdbc_user => "root"
        jdbc_password => ""
        statement => "SELECT * from yourtable"
    }
}
output {
    #stdout {codec => rubydebug}
    elasticsearch {
        hosts => "localhost:9200"
        index => "inandi"
        document_type => "name"
        document_id => "%{name}"
    }
}

Upvotes: 0

Related Questions