Permission error when performing logstash -f

Hi - I am very new to logstash and I am running into an issue when trying to perform a logstash - f on my .config file.

This is my .config file:

input {
file {
path => "/Users/alpitshah/Data/cars.csv"
start_position => "beginning"
sincedb_path => "/dev/null"
}
}
filter {
csv {

    separator => ","
            
    columns => ["maker","model","mileage","manufacture-year","engine_displacement","engine_power","body_type", "color_slug","stk_year","transmission","door_count","seat_count","fuel_type","date_created","date_last_seen", "price_eur"]
  }

 mutate {convert => ["mileage", "integer"]}
 mutate {convert => ["price_eur", "float"]}
 mutate {convert => ["door_count", "integer"]}
 mutate {convert => ["engine_power", "integer"]}
 mutate {convert => ["seat_count", "integer"]}

}
output {
elasticsearch {
hosts => "localhost"
index => "cars"
document_type => "sold_cars"
}
stdout {}
}

When I run the code: bin/logstash -f /Users/alpitshah/Data/logstash_cars.config

I get the following error:

Plugin: <LogStash::Inputs::File start_position=>"beginning", path=>["/Users/alpitshah/Data/cars.csv"], id=>"ba6990299d85aa8232a772dd81377d0289004654ce252354205802a68b7bde83", sincedb_path=>"/dev/null", enable_metric=>true, codec=><LogStash::Codecs::Plain id=>"plain_f0d1be3c-8bd2-4a80-a946-82deef5463a4", enable_metric=>true, charset=>"UTF-8">, stat_interval=>1.0, discover_interval=>15, sincedb_write_interval=>15.0, delimiter=>"\n", close_older=>3600.0, mode=>"tail", file_completed_action=>"delete", sincedb_clean_after=>1209600.0, file_chunk_size=>32768, file_chunk_count=>140737488355327, file_sort_by=>"last_modified", file_sort_direction=>"asc", exit_after_read=>false>

Error: Permission denied - Permission denied

Exception: Errno::EACCES

Stack: org/jruby/RubyFile.java:1269:in `utime'

uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/fileutils.rb:1133:in `block in touch'

org/jruby/RubyArray.java:1814:in `each'

uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/fileutils.rb:1130:in `touch'

/Users/alpitshah/logstash-7.6.2/vendor/bundle/jruby/2.5.0/gems/logstash-input-file-4.1.16/lib/filewatch/sincedb_collection.rb:22:in `initialize'

/Users/alpitshah/logstash-7.6.2/vendor/bundle/jruby/2.5.0/gems/logstash-input-file-4.1.16/lib/filewatch/observing_base.rb:62:in `build_watch_and_dependencies'

/Users/alpitshah/logstash-7.6.2/vendor/bundle/jruby/2.5.0/gems/logstash-input-file-4.1.16/lib/filewatch/observing_base.rb:56:in `initialize'

/Users/alpitshah/logstash-7.6.2/vendor/bundle/jruby/2.5.0/gems/logstash-input-file-4.1.16/lib/logstash/inputs/file.rb:341:in `start_processing'

/Users/alpitshah/logstash-7.6.2/vendor/bundle/jruby/2.5.0/gems/logstash-input-file-4.1.16/lib/logstash/inputs/file.rb:346:in `run'

/Users/alpitshah/logstash-7.6.2/logstash-core/lib/logstash/java_pipeline.rb:328:in `inputworker'

/Users/alpitshah/logstash-7.6.2/logstash-core/lib/logstash/java_pipeline.rb:320:in `block in start_input'

[2020-04-07T14:04:21,236][INFO ][filewatch.observingtail ][main] START, creating Discoverer, Watch with file and sincedb collections

[2020-04-07T14:04:21,239][ERROR][logstash.javapipeline ][main] A plugin had an unrecoverable error. Will restart this plugin.

Pipeline_id:main

I am not sure how to tackle this problem. I followed a Youtube tutorial and not sure what I am missing.

Any help would be much appreciated.

That code is trying to touch the sincedb. It appears you do not have write access to /dev/null. Check the permissions and ownership of it.

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