Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 3.4.3
- Allow YamlFile's Psych::Parser and Visitor instances to be garbage collected [#104](https://github.com/logstash-plugins/logstash-filter-translate/pull/104)

## 3.4.2
- Fixed JRuby 9.4 compatibility issue[#98](https://github.com/logstash-plugins/logstash-filter-translate/pull/98)

Expand Down
12 changes: 6 additions & 6 deletions lib/logstash/filters/dictionary/yaml_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ class YamlFile < File
protected

def initialize_for_file_type(**file_type_args)
@visitor = YamlVisitor.create

@parser = Psych::Parser.new(Psych::TreeBuilder.new)
@parser.code_point_limit = file_type_args[:yaml_code_point_limit]
@yaml_code_point_limit = file_type_args[:yaml_code_point_limit]
end

def read_file_into_dictionary
visitor = YamlVisitor.create
parser = Psych::Parser.new(Psych::TreeBuilder.new)
parser.code_point_limit = @yaml_code_point_limit
# low level YAML read that tries to create as
# few intermediate objects as possible
# this overwrites the value at key
yaml_string = IO.read(@dictionary_path, :mode => 'r:bom|utf-8')
@parser.parse(yaml_string, @dictionary_path)
@visitor.accept_with_dictionary(@dictionary, @parser.handler.root)
parser.parse(yaml_string, @dictionary_path)
visitor.accept_with_dictionary(@dictionary, parser.handler.root)
end
end
end end end
2 changes: 1 addition & 1 deletion logstash-filter-translate.gemspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Gem::Specification.new do |s|

s.name = 'logstash-filter-translate'
s.version = '3.4.2'
s.version = '3.4.3'
s.licenses = ['Apache License (2.0)']
s.summary = "Replaces field contents based on a hash or YAML file"
s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
Expand Down