I am unable to sync data from postgresql, Basically I am not able to start logstash

#Here is my config file
#--------- config file start----------------

Sample Logstash configuration for creating a simple

Beats -> Logstash -> Elasticsearch pipeline.

input{
jdbc{
jdbc_connection_string => "jdbc:postgresql://localhost:5432/dbName"
jdbc_user => "postgres"
jdbc_password => "root"
jdbc_driver_class => "org.postgresql.Driver"
statement => "SELECT * from public."questions\””
}
}

output {
elasticsearch {
hosts => ["http://localhost:9200"]
index => "questions"
document_id => "questions_%{id}"
doc_as_upsert => true
#user => "elastic"
#password => "changeme"
}
}

#------------------------------config file end--------------------------

Error:-
"Using bundled JDK: ""
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
Sending Logstash logs to C:/workspace/ELK/logstash-7.13.3-windows-x86_64/logstash-7.13.3/logs which is now configured via log4j2.properties
[2021-07-10T18:28:25,462][INFO ][logstash.runner ] Log4j configuration path used is: C:\workspace\ELK\logstash-7.13.3-windows-x86_64\logstash-7.13.3\config\log4j2.properties
[2021-07-10T18:28:25,474][INFO ][logstash.runner ] Starting Logstash {"logstash.version"=>"7.13.3", "jruby.version"=>"jruby 9.2.16.0 (2.5.7) 2021-03-03 f82228dc32 OpenJDK 64-Bit Server VM 11.0.11+9 on 11.0.11+9 +indy +jit [mswin32-x86_64]"}
[2021-07-10T18:28:25,555][WARN ][logstash.config.source.multilocal] Ignoring the 'pipelines.yml' file because modules or command line options are specified
[2021-07-10T18:28:26,261][INFO ][logstash.agent ] Successfully started Logstash API endpoint {:port=>9600}
[2021-07-10T18:28:26,260][ERROR][logstash.agent ] Failed to execute action {:action=>LogStash::PipelineAction::Create/pipeline_id:main, :exception=>"LogStash::ConfigurationError", :message=>"Expected one of [ \t\r\n], "#", "{", "}" at line 14, column 16 (byte 299) after input{\r\n\tjdbc{\r\n\t\tjdbc_connection_string => "jdbc:postgresql://localhost:5432/elk_poc"\r\n\t\tjdbc_user => "postgres"\r\n\t\tjdbc_password => "root"\r\n\t\tjdbc_driver_class => "org.postgresql.Driver"\r\n\t\tstatement => "SELECT * from public.\"questions\ΓÇ¥ΓÇ¥\r\n\t}\r\n}\r\n\r\noutput {\r\n elasticsearch {\r\n hosts => ["", :backtrace=>["C:/workspace/ELK/logstash-7.13.3-windows-x86_64/logstash-7.13.3/logstash-core/lib/logstash/compiler.rb:32:in compile_imperative'", "org/logstash/execution/AbstractPipelineExt.java:187:in initialize'", "org/logstash/execution/JavaBasePipelineExt.java:72:in initialize'", "C:/workspace/ELK/logstash-7.13.3-windows-x86_64/logstash-7.13.3/logstash-core/lib/logstash/java_pipeline.rb:47:in initialize'", "C:/workspace/ELK/logstash-7.13.3-windows-x86_64/logstash-7.13.3/logstash-core/lib/logstash/pipeline_action/create.rb:52:in execute'", "C:/workspace/ELK/logstash-7.13.3-windows-x86_64/logstash-7.13.3/logstash-core/lib/logstash/agent.rb:389:in block in converge_state'"]}
[2021-07-10T18:28:26,373][INFO ][logstash.runner ] Logstash shut down.
[2021-07-10T18:28:26,383][FATAL][org.logstash.Logstash ] Logstash stopped processing because of an error: (SystemExit) exit
org.jruby.exceptions.SystemExit: (SystemExit) exit
at org.jruby.RubyKernel.exit(org/jruby/RubyKernel.java:747) ~[jruby-complete-9.2.16.0.jar:?]
at org.jruby.RubyKernel.exit(org/jruby/RubyKernel.java:710) ~[jruby-complete-9.2.16.0.jar:?]
at C_3a_.workspace.ELK.logstash_minus_7_dot_13_dot_3_minus_windows_minus_x86_64.logstash_minus_7_dot_13_dot_3.lib.bootstrap.environment.(C:\workspace\ELK\logstash-7.13.3-windows-x86_64\logstash-7.13.3\lib\bootstrap\environment.rb:89) ~[?:?]

can someone help me with it, I am a beginner.

That looks like you have curly quotes are the end of your SQL statement, so they do not close the double quotes at the start. logstash is parsing

SELECT * from public."questions\””
}
}

output {
elasticsearch {
hosts => [

as the SQL statement, then cannot understand how to parse

http://localhost:9200

as an option of the jdbc input.

thanks a lot, @Badger. after removing quotes, it solve my problem.

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