encoding issue UnicodeDecodeError
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- rails, ruby
- Domain
- observability-sre
Research direction
Start with the FluentLogger.new/client.post call in the Rails app and compare the UTF-8 event with the JSON produced by the fluentd S3 configuration. Reproduce the user-agent example containing ê, then determine whether the logger changes it before transmission or whether the transformation occurs in fluentd or S3 output; done means the responsible component is identified and the encoding behavior is covered by a reproducible test.
Written by the indexing model from the issue text.
Description
Something within the logging pipeline is breaking encoding, but just for some characters.
I'm having a hard time reproducing this issue and i cannot pin point what is actually causing this but it seems that on the fluentd level, either the logger or fluentd itself.
I deployed fluentd in production and sending events from the Rails app using this logger. The logger is configured to send events to fluentd which sends it to S3 in as a gzip file.
I then have a processing pipeline using these files and here is where i started seeing the issues.
client config
client = Fluent::Logger::FluentLogger.new(
nil,
host: "localhost",
port: 24224,
use_nonblock: true,
wait_writeable: false
)
client.post("foo", event)
fluentd config
<match foo.**>
@type s3
@id S3_output
s3_bucket my-bucket
s3_region us-east-1
acl bucket-owner-full-control
store_as gzip_command
path preprocessed_logs/year=%Y/month=%-m/day=%-d/hour=%-H
s3_object_key_format "%{path}/#{Socket.gethostname}_%{hex_random}_%{index}.%{file_extension}"
<buffer time>
timekey 300
timekey_use_utc true
timekey_wait 30
@type file
path /var/log/td-agent/buffer/foo
</buffer>
<format>
@type json
</format>
</match>
It seems that some characters are badly encoded.
here is this user agent example:
'Mozilla/5.0 (iPhone; CPU iPhone OS 13_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Clube da Fluência'
was logged as:
'Mozilla/5.0 (iPhone; CPU iPhone OS 13_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Clube da Flu\xeancia'
ê got changed to \xea which is breaking decoding.
Do you think this might be something to do with how the logger is sending data to fluentd?
to add more context, I'm using this logger in a Rails app and what I log is requests informations. I have checked the Rails side of things and the string passed to the logger is UTF-8 encoded.
- Dominant language
- Ruby
- Stars
- 256
- Forks
- 77
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from fluent/fluent-logger-ruby
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
fluent/fluent-logger-ruby#111 · 1 comment ·
-
UDP Support Open
Difficulty 4/5 3-5 days Newbie friendliness 25/100
fluent/fluent-logger-ruby#88 · 1 reaction ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
fluent/fluent-logger-ruby#66 · 2 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
fluent/fluent-logger-ruby#46 · 1 comment · 2 reactions ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
fluent/fluent-logger-ruby#41 · 1 comment ·
All issues in fluent/fluent-logger-ruby
Similar issues
-
user-reported
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Kong/developer.konghq.com#7316 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
TheOdinProject/curriculum#31408 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
notch8/utk_knapsack#148 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
Homebrew/homebrew-cask#288729 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100