我正在尝试在我的Elasticsearch堆栈开发环境中开发一个新的logstash插件。
我首先使用logstash-plugin生成实用程序为我的新插件生成框架。一旦我准备好了,我就可以使用gem build实用程序构建我的插件了,它运行时没有错误,并为我创建了一个gem。然后,我运行logstash-plugin安装实用程序,它成功地安装了我的插件。
我的logstash.gem中的条目如下所示-- gem "logstash-output-s3-4.3.3", "0.1.0", :path => "./vendor/bundle/jruby/2.5.0/gems/logstash-output-s3-4.3.3"
然后,我从希望修改的实际logstash插件中提取代码,并将其复制到我的新插件目录中,然后创建一个新的logstash.conf文件,以便使用我的新插件进行测试,并启动logstash服务。它按照预期运行,将数据从相应的s3存储桶中监视的服务器中转移出来。
logstash.conf输出部分--
output {
s3{
region => "us-east-1"
bucket => "xxxx"
prefix => "Dev/xxxx/%{+YYYY}/%{+MM}/%{+dd}/"
server_side_encryption => true
server_side_encryption_algorithm => "aws:kms"
ssekms_key_id => "xxxx"
validate_credentials_on_root_bucket => false
codec => "json_lines"
size_file => 1024000
time_file => 5
rotation_strategy => "size_and_time"
temporary_directory => "../../LogstashS3OutputData/temp/"
canned_acl => "private"
}
s3{
region => "us-east-1"
bucket => "xxxx"
prefix => "Dev/xxxx/%{+YYYY}/%{+MM}/%{+dd}/"
server_side_encryption => true
server_side_encryption_algorithm => "aws:kms"
ssekms_key_id => "xxxx"
validate_credentials_on_root_bucket => false
codec => "json_lines"
size_file => 1024000
time_file => 5
rotation_strategy => "size_and_time"
temporary_directory => "../../LogstashS3OutputData/temp/"
canned_acl => "private"
}
}我的下一步是,也是我遇到问题的地方,是尝试为插件创建一个名为file_prefix的新属性--
s3{
region => "us-east-1"
bucket => "xxxx"
prefix => "Dev/xxxx/xxxx/%{+YYYY}/%{+MM}/%{+dd}/"
file_prefix => "test"
server_side_encryption => true
server_side_encryption_algorithm => "aws:kms"
ssekms_key_id => "arn:aws:kms:xxxx"
validate_credentials_on_root_bucket => false
codec => "json_lines"
size_file => 1024000
time_file => 5
rotation_strategy => "size_and_time"
temporary_directory => "../../LogstashS3OutputData/temp/"
canned_acl => "private"
}我在我的解决方案\vendor\bundle\jruby\2.5.0\gems\logstash-output-s3-4.3.3\spec\outputs\s3_spec.rb中修改了以下文件
在第15行\vendor\bundle\jruby\2.5.0\gems\logstash-output-s3-4.3.3\spec\supports\helpers.rb中添加了" file_prefix“=> file_prefix
在第12行添加了let(:file_prefix) {}在第19行添加了" file_prefix“=> file_prefix
在语句config::file_prefix,:validate => :string后面添加了config :prefix,:validate => :string,:default => '‘在第154行添加了@file_prefix = file_prefix现在当我启动日志存储服务时,收到此错误消息'file_prefix’for s3
我已经找过了,也试过了我能想到的所有方法,但我就是过不了这道坎。
蒂娅,比尔·杨曼
发布于 2020-06-18 21:18:53
这可以被认为是封闭的,因为我正在使用s3输出插件开发人员分支中的类似功能请求作为我的项目的起点。
谢谢,-Bill
https://stackoverflow.com/questions/62410559
复制相似问题