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

Support TLS settings when sending to Graylog #355

Closed
invidian opened this issue Oct 7, 2019 · 5 comments
Closed

Support TLS settings when sending to Graylog #355

invidian opened this issue Oct 7, 2019 · 5 comments
Labels

Comments

@invidian
Copy link

invidian commented Oct 7, 2019

As a follow up to #145, it would be great if we could also configure TLS options using env variables.

@invidian
Copy link
Author

invidian commented Oct 7, 2019

It seems with this simple configuration snippet:

    protocol "tcp"
    tls true

I get following error:

2019-10-07 13:06:35 +0000 [warn]: #0 [out_graylog] failed to flush the buffer. error_class="NoMethodError" error="undefined method `closed?' for nil:NilClass" plugin_id="out_graylog"
2019-10-07 13:06:35 +0000 [warn]: #0 [out_graylog] got unrecoverable error in primary and no secondary error_class=NoMethodError error="undefined method `closed?' for nil:NilClass"
  2019-10-07 13:06:35 +0000 [warn]: #0 /fluentd/vendor/bundle/ruby/2.6.0/gems/gelf-3.0.0/lib/gelf/transport/tcp.rb:22:in `reject'
  2019-10-07 13:06:35 +0000 [warn]: #0 /fluentd/vendor/bundle/ruby/2.6.0/gems/gelf-3.0.0/lib/gelf/transport/tcp.rb:22:in `block in send'
  2019-10-07 13:06:35 +0000 [warn]: #0 /fluentd/vendor/bundle/ruby/2.6.0/gems/gelf-3.0.0/lib/gelf/transport/tcp.rb:21:in `loop'
  2019-10-07 13:06:35 +0000 [warn]: #0 /fluentd/vendor/bundle/ruby/2.6.0/gems/gelf-3.0.0/lib/gelf/transport/tcp.rb:21:in `send'
  2019-10-07 13:06:35 +0000 [warn]: #0 /fluentd/vendor/bundle/ruby/2.6.0/gems/gelf-3.0.0/lib/gelf/notifier.rb:160:in `notify_with_level!'
  2019-10-07 13:06:35 +0000 [warn]: #0 /fluentd/vendor/bundle/ruby/2.6.0/gems/gelf-3.0.0/lib/gelf/notifier.rb:119:in `notify!'
  2019-10-07 13:06:35 +0000 [warn]: #0 /fluentd/vendor/bundle/ruby/2.6.0/gems/fluent-plugin-gelf-hs-1.0.8/lib/fluent/plugin/out_gelf.rb:92:in `block in write'
  2019-10-07 13:06:35 +0000 [warn]: #0 /fluentd/vendor/bundle/ruby/2.6.0/gems/fluentd-1.7.3/lib/fluent/event.rb:327:in `each'
  2019-10-07 13:06:35 +0000 [warn]: #0 /fluentd/vendor/bundle/ruby/2.6.0/gems/fluentd-1.7.3/lib/fluent/event.rb:327:in `block in each'
  2019-10-07 13:06:35 +0000 [warn]: #0 /fluentd/vendor/bundle/ruby/2.6.0/gems/fluentd-1.7.3/lib/fluent/plugin/buffer/memory_chunk.rb:81:in `open'
  2019-10-07 13:06:35 +0000 [warn]: #0 /fluentd/vendor/bundle/ruby/2.6.0/gems/fluentd-1.7.3/lib/fluent/plugin/buffer/memory_chunk.rb:81:in `open'
  2019-10-07 13:06:35 +0000 [warn]: #0 /fluentd/vendor/bundle/ruby/2.6.0/gems/fluentd-1.7.3/lib/fluent/event.rb:326:in `each'
  2019-10-07 13:06:35 +0000 [warn]: #0 /fluentd/vendor/bundle/ruby/2.6.0/gems/fluent-plugin-gelf-hs-1.0.8/lib/fluent/plugin/out_gelf.rb:90:in `write'
  2019-10-07 13:06:35 +0000 [warn]: #0 /fluentd/vendor/bundle/ruby/2.6.0/gems/fluentd-1.7.3/lib/fluent/compat/output.rb:131:in `write'
  2019-10-07 13:06:35 +0000 [warn]: #0 /fluentd/vendor/bundle/ruby/2.6.0/gems/fluentd-1.7.3/lib/fluent/plugin/output.rb:1125:in `try_flush'
  2019-10-07 13:06:35 +0000 [warn]: #0 /fluentd/vendor/bundle/ruby/2.6.0/gems/fluentd-1.7.3/lib/fluent/plugin/output.rb:1431:in `flush_thread_run'
  2019-10-07 13:06:35 +0000 [warn]: #0 /fluentd/vendor/bundle/ruby/2.6.0/gems/fluentd-1.7.3/lib/fluent/plugin/output.rb:461:in `block (2 levels) in start'
  2019-10-07 13:06:35 +0000 [warn]: #0 /fluentd/vendor/bundle/ruby/2.6.0/gems/fluentd-1.7.3/lib/fluent/plugin_helper/thread.rb:78:in `block in thread_create'
2019-10-07 13:06:35 +0000 [warn]: #0 [out_graylog] bad chunk is moved to /tmp/fluent/backup/worker0/out_graylog/59451b8670de4847070dced66cd07fa7.log

the TLS connection seems fine, when testing with this ruby snippet, which simulates what gelf output plugin is doing:

require 'socket'
require 'openssl'

myXML = '{"version": "1.1","host":"example.org","short_message":"Short message","full_message":"Backtrace here\n\nmore stuff","level":1,"_user_id":9001,"_some_info":"foo","_some_env_var":"bar"}'
host = 'graylog-tcp.graylog'
port = 12222

socket = TCPSocket.open(host,port)
ssl_context = OpenSSL::SSL::SSLContext.new()
ssl_context.cert_store = OpenSSL::X509::Store.new.tap do |store|
  store.set_default_paths
end
ssl_socket = OpenSSL::SSL::SSLSocket.new(socket, ssl_context)
ssl_socket.sync_close = true
ssl_socket.connect

ssl_socket.puts(myXML)
ssl_socket.close

It looks like https://github.com/hotschedules/fluent-plugin-gelf-hs/releases/tag/1.0.8 still use 3.0.0 version of gelf-rb and 3.1.0 is available already: https://github.com/graylog-labs/gelf-rb/releases/tag/v3.1.0, which contains a lot of new options and fixes.

@repeatedly
Copy link
Member

repeatedly commented Mar 5, 2020

gelf-rb has critical bug for fluentd and it is not fixed yet.

graylog-labs/gelf-rb#87

Please ping gelf-rb developers to fix the json issue.

@github-actions
Copy link

github-actions bot commented Mar 1, 2021

This issue has been automatically marked as stale because it has been open 90 days with no activity. Remove stale label or comment or this issue will be closed in 30 days

@github-actions github-actions bot added the stale label Mar 1, 2021
@github-actions
Copy link

github-actions bot commented Apr 1, 2021

This issue was automatically closed because of stale in 30 days

@github-actions github-actions bot closed this as completed Apr 1, 2021
@ciastooo
Copy link

@invidian, @repeatedly seems like gelf-rb is no longer maintained. Is there any other way to resolve this error? Seems like it makes setting up tls impossible

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants