Skip to content
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

Merged
merged 4 commits into from
Apr 20, 2016

Conversation

miyakawataku
Copy link
Contributor

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.

@@ -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| }
Copy link
Member

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?

@miyakawataku
Copy link
Contributor Author

@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?

@repeatedly
Copy link
Member

It seems ok for me.

@tagomoris @sonots How about this?

begin
Encoding.find(encoding_name)
rescue ArgumentError => e
raise ConfigError.new(e.message)
Copy link
Member

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

@sonots
Copy link
Member

sonots commented Apr 14, 2016

LGTM!!

@tagomoris
Copy link
Member

Totally LGTM.

@repeatedly repeatedly merged commit 5d153d9 into fluent:master Apr 20, 2016
@repeatedly
Copy link
Member

Thanks!

@repeatedly repeatedly added v0.12 feature request *Deprecated Label* Use enhancement label in general v0.14 labels May 16, 2016
repeatedly added a commit that referenced this pull request May 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request *Deprecated Label* Use enhancement label in general v0.12 v0.14
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants