0
votes

I use Docker to build my Logstash 7.10.1 image, I overrided logstash.conf with :

input {
  uri => "mongodb://admin:pass@localhost:27017/programs?ssl=true"
  placeholder_db_dir => "/opt/logstash-mongodb/"
  placeholder_db_name => "logstash_sqlite.db"
  collection => "programs"
  batch_size => 5000
}

output {
  elasticsearch {
    hosts => ["http://elasticsearch-crawlers:9200"]
    index => "programs"
    document_id => "%{id}"
  }
  stdout {
    codec => rubydebug
  }
}

I have this error :

[logstash.agent ] Failed to execute action {:action=>LogStash::PipelineAction::Create/pipeline_id:main, :exception=>"LogStash::ConfigurationError", :message=>"Expected one of [ \t\r\n], "#", "input", "filter", "output" at line 1, column 1 (byte 1)", :backtrace=>["/usr/share/logstash/logstash-core/lib/logstash/compiler.rb:32:in compile_imperative'", "org/logstash/execution/AbstractPipelineExt.java:184:in initialize'", "org/logstash/execution/JavaBasePipelineExt.java:69:in initialize'", "/usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:47:in initialize'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline_action/create.rb:52:in execute'", "/usr/share/logstash/logstash-core/lib/logstash/agent.rb:365:in block in converge_state'"]}

I am on Window, I used Notepad++ to create this logstash.conf file. I used Convert with BOM and I am on Unix (LF) format.

I don't see what is the problem here ? I checked this thread : Logstash exception Expected one of #, input, filter, output at line 1, column 1, but it seems my file is correct

1

1 Answers

3
votes

Your config is missing the input plugin type, it seems that you are using the mongodb input plugin.

Your config should be something like this.

input {
    mongodb {
        uri => "mongodb://admin:pass@localhost:27017/programs?ssl=true"
        placeholder_db_dir => "/opt/logstash-mongodb/"
        placeholder_db_name => "logstash_sqlite.db"
        collection => "programs"
        batch_size => 5000
    }
}