fluent-plugins-nursery / fluent-plugin-cloudwatch-logs

CloudWatch Logs Plugin for Fluentd
MIT License
201 stars 141 forks source link

Latest AWS SDK Gem Throws An Error #191

Closed doublecompile closed 4 years ago

doublecompile commented 4 years ago

Problem

After installing td-agent and adding my configuration file (specified below), the following exception is thrown.

Restarting td-agent: /opt/td-agent/embedded/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- aws-sdk-core/plugins/http_checksum.rb (LoadError)                        
        from /opt/td-agent/embedded/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'                                                                                                            
        from /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/aws-sdk-cloudwatchlogs-1.32.0/lib/aws-sdk-cloudwatchlogs/client.rb:27:in `<top (required)>'                                                                    
        from /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/aws-sdk-cloudwatchlogs-1.32.0/lib/aws-sdk-cloudwatchlogs.rb:13:in `require_relative'                                                                           
        from /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/aws-sdk-cloudwatchlogs-1.32.0/lib/aws-sdk-cloudwatchlogs.rb:13:in `<top (required)>'                                                                           
        from /opt/td-agent/embedded/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:133:in `require'                                                                                                           
        from /opt/td-agent/embedded/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:133:in `rescue in require'                                                                                                 
        from /opt/td-agent/embedded/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:39:in `require'                                                                                                            
        from /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-cloudwatch-logs-0.9.4/lib/fluent/plugin/out_cloudwatch_logs.rb:59:in `initialize'                                                                
        from /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/lib/fluent/plugin.rb:158:in `new'                                                                                                               
        from /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/lib/fluent/plugin.rb:158:in `new_impl'                                                                                                          
        from /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/lib/fluent/plugin.rb:109:in `new_output'                                                                                                        
        from /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/lib/fluent/agent.rb:130:in `add_match'                                                                                                          
        from /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/lib/fluent/agent.rb:74:in `block in configure'                                                                                                  
        from /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/lib/fluent/agent.rb:64:in `each'                                                                                                                
        from /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/lib/fluent/agent.rb:64:in `configure'                                                                                                           
        from /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/lib/fluent/root_agent.rb:146:in `configure'                                                                                                     
        from /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/lib/fluent/engine.rb:105:in `configure'                                                                                                         
        from /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/lib/fluent/engine.rb:80:in `run_configure'                                                                                                      
        from /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/lib/fluent/supervisor.rb:551:in `run_supervisor'                                                                                                
        from /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/lib/fluent/command/fluentd.rb:330:in `<top (required)>'                                                                                         
        from /opt/td-agent/embedded/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'                                                                                                            
        from /opt/td-agent/embedded/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'                                                                                                            
        from /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/bin/fluentd:8:in `<top (required)>'                                                                                                             
        from /opt/td-agent/embedded/bin/fluentd:23:in `load'                                                                                                                                                                
        from /opt/td-agent/embedded/bin/fluentd:23:in `<top (required)>'                                                                                                                                                    
        from /usr/sbin/td-agent:7:in `load'                                                                                                                                                                                 
        from /usr/sbin/td-agent:7:in `<main>'                                                                                                                                                                               
 * td-agent                                       

Steps to replicate

On a brand new Ubuntu Bionic (18.04) installation, I executed the following:

apt install -y ruby build-essential 
curl -L https://toolbelt.treasuredata.com/sh/install-ubuntu-bionic-td-agent3.sh | sh
td-agent-gem install fluent-plugin-rewrite-tag-filter
td-agent-gem install fluent-plugin-cloudwatch-logs

Example config:

<source>
  @type syslog
  port 42185
  bind 127.0.0.1
  tag rsyslog
  <parse>
    @type regexp
    expression /^(?<time>[^ ]*\s*[^ ]* [^ ]*) (?<host>[^ ]*) (?<ident>[a-zA-Z0-9_\/\.\- ]*)(?:\[(?<pid>[0-9]+)\])?(?:[^\:]*\:)? *(?<message>.*)$/
    time_format %b %d %H:%M:%S
  </parse>
</source>
<filter *.**>
  @type record_transformer
  <record>
    facility ${tag_parts[1]}
    severity ${tag_parts[2]}
  </record>
</filter>
<match *.**>
  @type cloudwatch_logs
  log_group_name "syslog"
  log_stream_name "testing-123"
  auto_create_stream true
  region "us-east-1"
  <buffer>
    @type memory
    flush_interval 10s
    overflow_action drop_oldest_chunk
  </buffer>
</match>

Expected Behavior or What you need to ask

I would expect the error to not appear and to start the daemon normally.

Using Fluentd and CloudWatchLogs plugin versions

addressable (2.7.0)                                                                                                                                                                                                         
async (1.24.2)                                                                                                                                                                                                              
async-http (0.50.8)                                                                                                                                                                                                         
async-io (1.27.7)                                                                                                                                                                                                           
async-pool (0.2.0)                                                                                                                                                                                                          
aws-eventstream (1.1.0)                                                                                                                                                                                                     
aws-partitions (1.297.0)                                                                                                                                                                                                    
aws-sdk-cloudwatchlogs (1.32.0)                                                                                                                                                                                             
aws-sdk-core (3.94.0)                                                                                                                                                                                                       
aws-sdk-kms (1.30.0)                                                                                                                                                                                                        
aws-sdk-s3 (1.63.0)                                                                                                                                                                                                         
aws-sdk-sqs (1.24.0)                                                                                                                                                                                                        
aws-sigv4 (1.1.1)                                                                                                                                                                                                           
bigdecimal (default: 1.3.2)                                                                                                                                                                                                 
bundler (1.16.6)                                                                                                                                                                                                            
concurrent-ruby (1.1.6)                                                                                                                                                                                                     
console (1.8.2)                                                                                                                                                                                                             
cool.io (1.6.0)                                                                                                                                                                                                             
did_you_mean (1.1.0)                                                                                                                                                                                                        
digest-crc (0.5.1)                                                                                                                                                                                                          
elasticsearch (6.8.1)                                                                                                                                                                                                       
elasticsearch-api (6.8.1)                                                                                                                                                                                                   
elasticsearch-transport (6.8.1)                                                                                                                                                                                             
excon (0.73.0)                                                                                                                                                                                                              
faraday (0.17.3)                                                                                                                                                                                                            
ffi (1.12.2)                                                                                                                                                                                                                
fluent-config-regexp-type (1.0.0)                                                                                                                                                                                           
fluent-logger (0.8.2)                                                                                                                                                                                                       
fluent-plugin-cloudwatch-logs (0.9.4)                                                                                                                                                                                       
fluent-plugin-elasticsearch (4.0.7)                                                                                                                                                                                         
fluent-plugin-kafka (0.13.0)                                                                                                                                                                                                
fluent-plugin-prometheus (1.7.3)                                                                                                                                                                                            
fluent-plugin-prometheus_pushgateway (0.0.2)                                                                                                                                                                                
fluent-plugin-record-modifier (2.1.0)                                                                                                                                                                                       
fluent-plugin-rewrite-tag-filter (2.3.0, 2.2.0)                                                                                                                                                                             
fluent-plugin-s3 (1.3.1)                                                                                                                                                                                                    
fluent-plugin-systemd (1.0.2)                                                                                                                                                                                               
fluent-plugin-td (1.1.0)                                                                                                                                                                                                    
fluent-plugin-td-monitoring (0.2.4)                                                                                                                                                                                         
fluent-plugin-webhdfs (1.2.4)                                                                                                                                                                                               
fluentd (1.10.2)                                                                                                                                                                                                            
hirb (0.7.3)                                                                                                                                                                                                                
http_parser.rb (0.6.0)                                                                                                                                                                                                      
httpclient (2.8.2.4)
io-console (default: 0.4.6)
ipaddress (0.8.3)
jmespath (1.4.0)
json (default: 2.0.4)
ltsv (0.1.2)
mini_portile2 (2.4.0)
minitest (5.10.1)
mixlib-cli (1.7.0)
mixlib-config (2.2.4)
mixlib-log (1.7.1)
mixlib-shellout (2.2.7)
msgpack (1.3.3)
multi_json (1.14.1)
multipart-post (2.1.1)
net-telnet (0.1.1)
nio4r (2.5.2)
nokogiri (1.10.9)
ohai (6.20.0)
oj (3.8.1)
openssl (default: 2.0.9)
parallel (1.19.1)
power_assert (0.4.1)
prometheus-client (0.9.0)
protocol-hpack (1.4.2)
protocol-http (0.15.1)
protocol-http1 (0.10.3)
protocol-http2 (0.11.6)
psych (default: 2.2.2)
public_suffix (4.0.4)
quantile (0.2.1)
rake (12.3.3, 12.0.0)
rdkafka (0.7.0)
rdoc (default: 5.0.1)
ruby-kafka (1.0.0)
ruby-progressbar (1.10.1)
rubyzip (1.3.0)
serverengine (2.2.1)
sigdump (0.2.4)
strptime (0.2.3)
systemd-journal (1.3.3)
systemu (2.5.2)
td (0.16.8)
td-client (1.0.7)
td-logger (0.3.27)
test-unit (3.2.3)
timers (4.3.0)
tzinfo (2.0.2)
tzinfo-data (1.2019.3)
webhdfs (0.9.0)
xmlrpc (0.2.1)
yajl-ruby (1.4.1)
zip-zip (0.3)
aisachenka commented 4 years ago

I checked the aws-sdk-cloudwatchlogs (1.29.0) - it works. Looks like the problem in the aws-sdk-cloudwatchlogs (1.32.0)

doublecompile commented 4 years ago

It looks like this is an upstream problem with the dependency constraints of the aws-sdk-cloudwatchlogs gem. See aws/aws-sdk-ruby#2327.

doublecompile commented 4 years ago

It appears I can get around the error by manually installing the newer version of the aws-sdk-core gem.

td-agent-gem install aws-sdk-core -v 3.99.0
service td-agent restart
doublecompile commented 4 years ago

The upstream issue has been fixed and I can confirm that running the above commands no longer generates an exception.