-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add "encoding" parameter to in_tail plugin #889
Add "encoding" parameter to in_tail plugin #889
Conversation
@@ -370,6 +381,42 @@ def test_whitespace | |||
assert_equal({"message" => "tab "}, emits[5][2]) | |||
end | |||
|
|||
def test_default_encoding | |||
File.open("#{TMP_DIR}/tail.txt", "wb") {|f| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting read_from_head true
is better than creating a file here?
@repeatedly I have refined the tests. It seems that the failure on Travis CI (https://travis-ci.org/fluent/fluentd/jobs/122757775) is not related with this PR. Could you restart the job? |
It seems ok for me. @tagomoris @sonots How about this? |
begin | ||
Encoding.find(encoding_name) | ||
rescue ArgumentError => e | ||
raise ConfigError.new(e.message) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newing error looks a bit curious for me. I like: raise ConfigError, e.message
LGTM!! |
Totally LGTM. |
Thanks! |
Add "encoding" parameter to in_tail plugin
Currently,
in_tail
plugin emits strings with ASCII-8BIT encoding, which is resulted from IO#readpartial. This behavior entails inconvenience when filtering records. For example:This PR adds
encoding
parameter to in_tail plugin, leaving ASCII-8BIT as default for compatibility.