Getting error while importing csv file to logstash

[2021-10-05T16:59:04,940][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 5, column 17 (byte 95) after input {\n\tFile {\n\tpath => "/var/lib/logstash/report1633160321384.csv"\n\t }\n\tstart_position ", :backtrace=>["/usr/share/logstash/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'", "/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:391:in block in converge_state'"]}
[2021-10-05T16:59:05,057][INFO ][logstash.runner ] Logstash shut down.
[2021-10-05T16:59:05,069][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.19.0.jar:?]
at org.jruby.RubyKernel.exit(org/jruby/RubyKernel.java:710) ~[jruby-complete-9.2.19.0.jar:?]
at usr.share.logstash.lib.bootstrap.environment.(/usr/share/logstash/lib/bootstrap/environment.rb:94) ~[?:?]

below is the config file

input {
file {
path => "/var/lib/logstash/report1.csv"
start_position => "begining"
sincedb-path => "/dev/null"
}
}
filter {
csv{
separator => "."
skip_header => "true"
colomns => ["event_name", event_type_type","reporting_ip","event_receive_time"]
}
}
output {
Elasticsearch {
hosts => "https://localhosts:9200"
index => "demo-csv"
}
stdout{}

Change = to =>

Its is same as you mentioned.

[quote="SSirurmath, post:1, topic:285954"]
input {
file {
path => "/var/lib/logstash/report1.csv"
start_position => "begining"
sincedb-path => "/dev/null"
}
}
filter {
csv{
separator => "."
skip_header => "true"
colomns => ["event_name", event_type_type","reporting_ip","event_receive_time"]
}
}
output {
Elasticsearch {
hosts => "https://localhosts:9200"
index => "demo-csv"
}
stdout{}

You need to show us the configuration and the error that you get with that configuration. Currently they do not match.

Below is the error,

[2021-10-05T16:59:04,940][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 5, column 17 (byte 95) after input {\n\tFile {\n\tpath => "/var/lib/logstash/report1633160321384.csv"\n\t }\n\tstart_position ", :backtrace=>["/usr/share/logstash/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'", "/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:391:in block in converge_state'"]}
[2021-10-05T16:59:05,057][INFO ][logstash.runner ] Logstash shut down.
[2021-10-05T16:59:05,069][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.19.0.jar:?]
at org.jruby.RubyKernel.exit(org/jruby/RubyKernel.java:710) ~[jruby-complete-9.2.19.0.jar:?]
at usr.share.logstash.lib.bootstrap.environment.(/usr/share/logstash/lib/bootstrap/environment.rb:94) ~[?:?]

Again, the configuration and the error message do not match. The error message shows that you have a } immediately after the path option on the file input, which means logstash would interpret start_position as an input plugin name, and expect it to be followed by {, not =>

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