questions about IOHandler class in "in_tail.rb"

21 views
Skip to first unread message

Eugene Gwon

unread,
Jun 16, 2016, 4:00:45 AM6/16/16
to Fluentd Google Group
Hello,
    I'm using Fluentd with Graylog. these combination works well, but unfortunately, Fluentd can't parsing Korean characters by default
after I modified IOHandler class in "in_tail.rb", then It parsing without error.

but I'm new to Fluentd and Ruby, so I'm not sure that my modification is correct...
Is it safe to use? 

thanks for any help :)

--------------------------------------------------------------------

here's the code :
(/opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.12.20/lib/fluent/plugin/in_tail.rb)

class IOHandler
    def initialize(io, pe, log, read_lines_limit, first = true, &receive_lines)

         @log = log

         @log.info "following tail of #{io.path}" if first

         @io = io

         @pe = pe

         @read_lines_limit = read_lines_limit

         @receive_lines = receive_lines


         #Eugene modified for korean character convert error

         #@buffer = ''.force_encoding('ASCII-8BIT')

         #@iobuf = ''.force_encoding('ASCII-8BIT')

         @buffer = ''.force_encoding('UTF-8')
         @iobuf = ''.force_encoding('UTF-8')

   end


and here's the version of td-agent :

ii  td-agent        2.3.1-0    amd64     Treasure Agent: A data collector for Treasure Data




Mr. Fiber

unread,
Jun 16, 2016, 4:15:54 AM6/16/16
to Fluentd Google Group
It seems safe for me.
But if your logs contain invalid charactor as a UTF-8,
in_tail will raise an error.


Masahiro

--
You received this message because you are subscribed to the Google Groups "Fluentd Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fluentd+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Eugene Gwon

unread,
Jun 16, 2016, 9:08:52 PM6/16/16
to Fluentd Google Group
Thanks for your response :)
Reply all
Reply to author
Forward
0 new messages