scalyr / scalyr-fluentd

The fluentd plugin for inserting log messages and metrics in Scalyr.
Apache License 2.0
6 stars 5 forks source link

undefined local variable or method `router' for Scalyr::ScalyrOut #9

Closed wendorf closed 6 years ago

wendorf commented 6 years ago

I'm using fluent-plugin-scalyr 0.8.3 with fluentd 1.1.0 and am seeing errors in the fluentd logs that I believe correspond with a lack of logs getting emitted to Scalyr:

2018-04-18 15:41:30 +0000 [info]: #0 stats - namespace_cache_size: 1, pod_cache_size: 8, namespace_cache_api_updates: 164, pod_cache_api_updates: 178, id_cache_miss: 164
2018-04-18 15:41:42 +0000 [warn]: #0 Encoding::UndefinedConversionError: "\xC2" from ASCII-8BIT to UTF-8
2018-04-18 15:41:42 +0000 [warn]: #0 failed to flush the buffer. retry_time=32 next_retry_seconds=2018-04-18 15:41:42 +0000 chunk="56a21147269f9e1714d0a661312d106f" error_class=NameError error="undefined local variable or method `router' for #<Scalyr::ScalyrOut:007fec669f62a8>"
  2018-04-18 15:41:42 +0000 [warn]: #0 suppressed same stacktrace
anup3000 commented 6 years ago

Dan,

Which application or platform logs are you trying to upload to Scalyr? Are you trying to load Kubernetes metadata?

Regards, Anup

imron commented 6 years ago

This problem was caused by something missed during the upgrade from 0.12 -> 1.0, and I've just pushed a commit (debc460c9eb) that should fix the issue and bumped the version number to 0.8.4.

wendorf commented 6 years ago

@imron Thanks! I'll check out the new version and report back.

@anup3000 Yes, I'm loading Kubernetes metadata on Kubernetes 1.9.6

imron commented 6 years ago

You'll likely still get a warning because the issue appears to have been triggered by invalid utf-8, but the handling of that UndefinedConversionError will no longer have errors and the plugin will log the event with any invalid utf replaced with <?>

wendorf commented 6 years ago

@imron I just tried to test, but the updated gem hasn't been published to RubyGems? Can you publish it? Thanks!

anup3000 commented 6 years ago

@wendorf We will work on publishing the gem and let you know when it is available. - Thanks

wendorf commented 6 years ago

Looks great! I'm now getting the more-expected:

2018-04-19 22:35:05 +0000 [warn]: #0 Encoding::UndefinedConversionError: "\xC2" from ASCII-8BIT to UTF-8
2018-04-19 22:35:05 +0000 [warn]: #0 dump an error event: error_class=Encoding::UndefinedConversionError error="\"\\xC2\" from ASCII-8BIT to UTF-8" location="/opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-plugin-scalyr-0.8.4/lib/fluent/plugin/out_scalyr.rb:321:in `encode'" tag="kube-apiserver" time=#<Fluent::EventTime:0x007f27e277c048 @sec=1524177292, @nsec=443552000> record={"severity"=>"I", "time"=>"0419 22:34:52.443552", "pid"=>"1", "source"=>"wrap.go:42", "message"=>"GET /api/v1/namespaces/kube-system/endpoints/kube-scheduler: (795.938\xC2\xB5s) 200 [[kube-scheduler/v1.9.6 (linux/amd64) kubernetes/9f8ebd1/leader-election] 127.0.0.1:58672]", "logfile"=>"/fluentd/kube-apiserver"}

Thanks for the rapid response on this!

anup3000 commented 6 years ago

Hi Dan,

We have uploaded new gem. Please let us know how it goes.

Regards, Anup