Skip to content
This repository has been archived by the owner on Jul 19, 2023. It is now read-only.

Commit

Permalink
Merge pull request #15 from EmpaticoOrg/awscheckerrs
Browse files Browse the repository at this point in the history
Patch related to the autoloading and ruby
  • Loading branch information
lukewaite authored Mar 31, 2017
2 parents d3358ab + 579b05e commit 422b9ae
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
20 changes: 20 additions & 0 deletions lib/logstash/inputs/cloudwatch/patch.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# This is patch related to the autoloading and ruby
#
# The fix exist in jruby 9k but not in the current jruby, not sure when or it will be backported
# https://github.com/jruby/jruby/issues/3645
#
# AWS is doing tricky name discovery in the module to generate the correct error class and
# this strategy is bogus in jruby and `eager_autoload` don't fix this issue.
#
# This will be a short lived patch since AWS is removing the need.
# see: https://github.com/aws/aws-sdk-ruby/issues/1301#issuecomment-261115960
old_stderr = $stderr

$stderr = StringIO.new
begin
module Aws
const_set(:CloudWatchLogs, Aws::CloudWatchLogs)
end
ensure
$stderr = old_stderr
end
3 changes: 3 additions & 0 deletions lib/logstash/inputs/cloudwatch_logs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
require "tmpdir"
require "stud/interval"
require "stud/temporary"
require "logstash/inputs/cloudwatch/patch"

Aws.eager_autoload!

# Stream events from ClougWatch Logs streams.
#
Expand Down

0 comments on commit 422b9ae

Please sign in to comment.