logstash-plugins / logstash-codec-avro

A logstash codec plugin for decoding and encoding Avro records
Apache License 2.0
15 stars 63 forks source link

Fix no such file or dir error. #43

Closed mashhurs closed 1 year ago

mashhurs commented 1 year ago

Description

Logstash 8.10+ versions fail with (Errno::ENOENT) No such file or directory error. It is happening after Ruby 2.6 to Ruby 3.1 upgrade through JRuby. As a solution, it seems there are multiple discussions (1, 2) and current solution is to change open to URI.open

Test

output { stdout { codec => rubydebug } kafka { bootstrap_servers => "192.168.1.66:9092" codec => avro { schema_uri => "http://127.0.0.1:8081/my-schema"

schema_uri => "/static/avro-sample.xml"

        encoding => "binary"
    }
    topic_id => "sample"
}

}

- output logs

[2023-10-13T11:01:11,713][DEBUG][logstash.plugins.registry] On demand adding plugin to the registry {:name=>"avro", :type=>"codec", :class=>LogStash::Codecs::Avro} [2023-10-13T11:01:11,714][DEBUG][logstash.codecs.avro ] config LogStash::Codecs::Avro/@encoding = "binary" [2023-10-13T11:01:11,714][DEBUG][logstash.codecs.avro ] config LogStash::Codecs::Avro/@schema_uri = "/Users/mashhur/Dev/elastic/temp/simple-nodejs/static/avro-sample.xml" [2023-10-13T11:01:11,715][DEBUG][logstash.codecs.avro ] config LogStash::Codecs::Avro/@id = "96ef7bd9-34cc-4a71-b184-c6087411fa3c" [2023-10-13T11:01:11,715][DEBUG][logstash.codecs.avro ] config LogStash::Codecs::Avro/@enable_metric = true [2023-10-13T11:01:11,715][DEBUG][logstash.codecs.avro ] config LogStash::Codecs::Avro/@tag_on_failure = false