Coder Social home page Coder Social logo

Can't send about fluent-plugin-slack HOT 4 CLOSED

sowawa avatar sowawa commented on August 21, 2024
Can't send

from fluent-plugin-slack.

Comments (4)

sonots avatar sonots commented on August 21, 2024

It is wierd. out_slack.rb does require slack_client.rb and, it does require net/http at

. So, Net::OpenTimeout must be defined.

In my environment, irb tells like follows:

irb> Net::OpenTimeout
NameError: uninitialized constant Net
irb> require 'net/http'
irb> Net::OpenTimeout
Net::OpenTimeout

The ruby version was 2.1.2.

Could you tell me your td-agent version and its ruby version?

from fluent-plugin-slack.

airtoxin avatar airtoxin commented on August 21, 2024

I use system ruby 2.1.2 and td-agent 2.1.0(fluentd 0.10.53)
But fluentd use ruby 1.9.1.
fluentd's irb says

irb(main):001:0> Net::OpenTimeout
NameError: uninitialized constant Net
    from (irb):1
    from /usr/lib64/fluent/ruby/bin/irb:12:in `<main>'
irb(main):002:0> require 'net/http'
=> true
irb(main):003:0> Net::OpenTimeout
NameError: uninitialized constant Net::OpenTimeout
    from (irb):3
    from /usr/lib64/fluent/ruby/bin/irb:12:in `<main>'

And another try, I insert some debug logs in slack_client.rb

      def post(endpoint, params)
log.info "@endpoint: ", endpoint
        http = proxy_class.new(endpoint.host, endpoint.port)
        http.use_ssl = (endpoint.scheme == 'https')
        http.verify_mode = OpenSSL::SSL::VERIFY_NONE
        http.set_debug_output(debug_dev) if debug_dev
log.info "@http: ", http

        req = Net::HTTP::Post.new(endpoint)
log.info "@req: ", req
        req['Host'] = endpoint.host
        req['Accept'] = 'application/json; charset=utf-8'
        req['User-Agent'] = 'fluent-plugin-slack'
        req.body = encode_body(params)

        res = http.request(req)
        response_check(res, params)
      end

and got a new log

2015-05-15 10:02:35 +0900 [info]: out_slack: post_message {:channel=>"#logs", :text=>"oooooooooooooo\n", :mrkdwn=>true, :link_names=>true}
2015-05-15 10:02:35 +0900 [info]: @endpoint: https://hooks.slack.com/services/xxxxx/xxxxx/xxxxxxxxxx
2015-05-15 10:02:35 +0900 [info]: @http: #<Net::HTTP:0x007f726ffbb268>
2015-05-15 10:02:35 +0900 [warn]: temporarily failed to flush the buffer. next_retry=2015-05-15 10:07:19 +0900 error_class="NameError" error="uninitialized constant Net::OpenTimeout" instance=70064779390100
  2015-05-15 10:02:35 +0900 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-slack-0.6.0/lib/fluent/plugin/out_slack.rb:131:in `rescue in write'
  2015-05-15 10:02:35 +0900 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-slack-0.6.0/lib/fluent/plugin/out_slack.rb:128:in `write'
  2015-05-15 10:02:35 +0900 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.53/lib/fluent/buffer.rb:296:in `write_chunk'
  2015-05-15 10:02:35 +0900 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.53/lib/fluent/buffer.rb:276:in `pop'
  2015-05-15 10:02:35 +0900 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.53/lib/fluent/output.rb:311:in `try_flush'
  2015-05-15 10:02:35 +0900 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.53/lib/fluent/output.rb:132:in `run'

no req output so Net::HTTP::Post.new(endpoint) failed.

from fluent-plugin-slack.

sonots avatar sonots commented on August 21, 2024

@airtoxin I fixed fluent-plugin-slack to work with ruby 1.9.3. Could you try the latest version? It could work with 1.9.1 possibly although I won't support ruby 1.9.1 officially. 1.9.1, even 1.9.3 are end of life already.

from fluent-plugin-slack.

airtoxin avatar airtoxin commented on August 21, 2024

@sonots It works!
And I try to update td-agent newer one. Very thank you!

from fluent-plugin-slack.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.