There is Expected one of [ \\t\\r\\n] error in docker

when i running logstash in mac os, it works well.
but when i running docker container with same logstash.conf file, logstash container die with
"exception=>"LogStash::ConfigurationError", :message=>"Expected one of [ \t\r\n]"

I really don't see what the problem is.

What is the complete error message and what is the configuration?

Following is full error message

   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 51, column 1 (byte 1469) after ", :backtrace=>
    ["/usr/share/logstash/logstash-core/lib/logstash/compiler.rb:41:in `compile_imperative'", 
    "/usr/share/logstash/logstash-core/lib/logstash/compiler.rb:49:in `compile_graph'", 
    "/usr/share/logstash/logstash-core/lib/logstash/compiler.rb:11:in `block in compile_sources'",
     "org/jruby/RubyArray.java:2584:in `map'", "/usr/share/logstash/logstash-
    core/lib/logstash/compiler.rb:10:in `compile_sources'", 
    "org/logstash/execution/AbstractPipelineExt.java:156:in `initialize'", 
    "org/logstash/execution/JavaBasePipelineExt.java:47:in `initialize'", 
    "/usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:27:in `initialize'", 
    "/usr/share/logstash/logstash-core/lib/logstash/pipeline_action/create.rb:36:in `execute'", 
    "/usr/share/logstash/logstash-core/lib/logstash/agent.rb:326:in `block in converge_state'"]}

and following is my configuration

input {
  jdbc {
jdbc_driver_library => "/usr/share/logstash/mysql-connector-java-5.1.47-bin.jar"
jdbc_driver_class => "com.mysql.jdbc.Driver"
jdbc_connection_string => "jdbc:mysql://${HOST}:${PORT}/${DATABASE}"
jdbc_user => "${USER}"
jdbc_password => "${PASSWORD}"
jdbc_paging_enabled => true
jdbc_default_timezone => "Asia/Seoul"
use_column_value => false
clean_run => true
schedule => "*/1 * * * *"
statement_filepath => "/usr/share/logstash/pipeline/test.sql"
  }
}
filter {
  aggregate {
task_id => "%{code}"
  code => "
    map['code'] = event.get('code')
    map['location'] ||= {}
    map['location']['lat'] = event.get('latitude')
    map['location']['lon'] = event.get('longitude')

    map['title'] ||= {}
    if (event.get('translations_language') != nil)
      if !( map['title'][event.get('translations_language')] )
        map['title'][event.get('translations_language')] = event.get('translations_name')
      end
    end
    event.cancel()
  "
  push_previous_map_as_event => true
  timeout => 5
  }
  mutate {
copy => { "code" => "[@metadata][_id]" }
remove_field => ["id", "@version", "unix_ts_in_secs"]
  }
}
output {
  elasticsearch {
hosts => ["${ELASTICHOST}"]
user => "${ELASTICUSER}"
password => "${ELASTICPASSWORD}"
index => "${ELASTICINDEX}"
document_id => "%{[@metadata][_id]}"
  }
}

It is complaining about line 51 and you are showing a 49 line configuration. Perhaps you are pointing path.config at a directory and it is picking up a second file. Try running with --config.debug --log.level debug --config.test_and_exit on the command line.

1 Like

I'm really grateful for your help. I put the test.sql file into pipeline directory, logstash though of the test.sql file as a conf file. When I moved the test.sql file, it worked.

Thank you

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