Import csv to Logstash 7.5.2 on Windows (Failed to execute action, expected one of... )

I'm trying to import csv to elasticsearch using logstash. but I'm not being able of doing it.

As I searched for this error, this is usually related with mistyping something or missing character.

But as far as I inspected I could not found the error.

Please find my sample file:

input {
	file {
		path => ["C:/elk/sample-data/data-03_02_2020.csv"]
		start_position => "beginning"
		sincedb_path => "NUL"
	}
}

filter {
	csv {
		separator => ","
		columns => ["Date", "Sleep Time", "Wake Time", "Hours"	"Note"]
	}
	mutate {convert => ["Hours", "float"]}
}


output {
	elasticsearch {
		hosts => "localhost:9200" 
		index => "dataindex"
	}
	stdout {}
}

This is my output:

PS C:\elk\l> .\bin\logstash.bat -f .\config\logstash-data.conf
Java HotSpot(TM) 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.jruby.runtime.encoding.EncodingService (file:/C:/elk/l/logstash-core/lib/jars/jruby-complete-9.2.8.0.jar) to field java.io.Console.cs
WARNING: Please consider reporting this to the maintainers of org.jruby.runtime.encoding.EncodingService
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Thread.exclusive is deprecated, use Thread::Mutex
Sending Logstash logs to C:/elk/l/logs which is now configured via log4j2.properties
[2020-02-03T16:08:30,845][WARN ][logstash.config.source.multilocal] Ignoring the 'pipelines.yml' file because modules or command line options are specified
[2020-02-03T16:08:31,159][INFO ][logstash.runner          ] Starting Logstash {"logstash.version"=>"7.5.2"}
[2020-02-03T16:08:33,189][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 15, column 58 (byte 331) after filter {\n\tcsv {\n\t\tseparator => \",\"\n\t\tcolumns => [\"Date\", \"Sleep Time\", \"Wake Time\", \"Hours\"\t", :backtrace=>["C:/elk/l/logstash-core/lib/logstash/compiler.rb:41:in `compile_imperative'", "C:/elk/l/logstash-core/lib/logstash/compiler.rb:49:in `compile_graph'", "C:/elk/l/logstash-core/lib/logstash/compiler.rb:11:in `block in compile_sources'", "org/jruby/RubyArray.java:2584:in `map'", "C:/elk/l/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'", "C:/elk/l/logstash-core/lib/logstash/java_pipeline.rb:27:in `initialize'", "C:/elk/l/logstash-core/lib/logstash/pipeline_action/create.rb:36:in `execute'", "C:/elk/l/logstash-core/lib/logstash/agent.rb:326:in `block in converge_state'"]}

Missing a comma between "Hours" and "Note".

Thank you so much for the help and swiftness Badger!

It worked out, is there any tool to help find this type of errors?

Cheers

You just have to read the error message

Expected one of [ \t\r\n], "#", "{", ",", "]" at line 15, column 58 (byte 331) after filter {\n\tcsv {\n\t\tseparator => ","\n\t\tcolumns => ["Date", "Sleep Time", "Wake Time", "Hours"\t"

and then look at what comes next in the configuration file. Here that points to exactly where the problem is, although that is not always the case and some of these errors can be tricky to figure out.

Thank you Badger.

Cheers

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