shinsaka / fluent-plugin-elb-log

Amazon ELB log input plugin
MIT License
39 stars 23 forks source link

Out of memory error #45

Open delaskoff opened 3 years ago

delaskoff commented 3 years ago

Hello. I've encountered with such an issue. This is the full stack trace of the error: 2021-03-03 07:31:57.132920493 +0000 fluent.warn: {"message":"error occurred: Out of memory @ io_write - /tmp/fluentd-elblog.tmpfile, [\"/usr/lib/ruby/gems/2.7.0/gems/fluent-plugin-elb-log-1.3.2/lib/fluent/plugin/in_elb_log.rb:239:in `write'\", \"/usr/lib/ruby/gems/2.7.0/gems/fluent-plugin-elb-log-1.3.2/lib/fluent/plugin/in_elb_log.rb:239:in `block (3 levels) in inflate'\", \"/usr/lib/ruby/gems/2.7.0/gems/fluent-plugin-elb-log-1.3.2/lib/fluent/plugin/in_elb_log.rb:237:in `loop'\", \"/usr/lib/ruby/gems/2.7.0/gems/fluent-plugin-elb-log-1.3.2/lib/fluent/plugin/in_elb_log.rb:237:in `block (2 levels) in inflate'\", \"/usr/lib/ruby/gems/2.7.0/gems/fluent-plugin-elb-log-1.3.2/lib/fluent/plugin/in_elb_log.rb:235:in `open'\", \"/usr/lib/ruby/gems/2.7.0/gems/fluent-plugin-elb-log-1.3.2/lib/fluent/plugin/in_elb_log.rb:235:in `block in inflate'\", \"/usr/lib/ruby/gems/2.7.0/gems/fluent-plugin-elb-log-1.3.2/lib/fluent/plugin/in_elb_log.rb:234:in `open'\", \"/usr/lib/ruby/gems/2.7.0/gems/fluent-plugin-elb-log-1.3.2/lib/fluent/plugin/in_elb_log.rb:234:in`inflate'\", \"/usr/lib/ruby/gems/2.7.0/gems/fluent-plugin-elb-log-1.3.2/lib/fluent/plugin/in_elb_log.rb:259:in `block in get_file_from_s3'\", \"/usr/lib/ruby/2.7.0/tempfile.rb:332:in `create'\", \"/usr/lib/ruby/gems/2.7.0/gems/fluent-plugin-elb-log-1.3.2/lib/fluent/plugin/in_elb_log.rb:253:in `get_file_from_s3'\", \"/usr/lib/ruby/gems/2.7.0/gems/fluent-plugin-elb-log-1.3.2/lib/fluent/plugin/in_elb_log.rb:153:in `block in input'\", \"/usr/lib/ruby/gems/2.7.0/gems/fluent-plugin-elb-log-1.3.2/lib/fluent/plugin/in_elb_log.rb:138:in `each'\", \"/usr/lib/ruby/gems/2.7.0/gems/fluent-plugin-elb-log-1.3.2/lib/fluent/plugin/in_elb_log.rb:138:in `input'\", \"/usr/lib/ruby/gems/2.7.0/gems/fluentd-1.11.4/lib/fluent/plugin_helper/timer.rb:80:in `on_timer'\", \"/usr/lib/ruby/gems/2.7.0/gems/cool.io-1.7.1/lib/cool.io/loop.rb:88:in `run_once'\", \"/usr/lib/ruby/gems/2.7.0/gems/cool.io-1.7.1/lib/cool.io/loop.rb:88:in `run'\", \"/usr/lib/ruby/gems/2.7.0/gems/fluentd-1.11.4/lib/fluent/plugin_helper/event_loop.rb:93:in `block in start'\", \"/usr/lib/ruby/gems/2.7.0/gems/fluentd-1.11.4/lib/fluent/plugin_helper/thread.rb:78:in `block in thread_create'\"]"} Is that because we`re using Ruby 2.7.0? My fluentd config:

<label @FLUENT_LOG>
  <match fluent.**>
    @type stdout
  </match>
</label>

<source>
  @type elb_log
  region "#{ENV['S3_REGION']}"
  s3_bucketname "#{ENV['S3_ELB_BUCKET']}"
  timestamp_file /tmp/elb_last_at.dat
  buf_file /tmp/fluentd-elblog.tmpfile
  refresh_interval 60
  include_all_message false
</source>

<filter elb.access>
  @type elasticsearch_genid
  use_entire_record true
  hash_type sha1
  hash_id_key _hash
  separator _
  include_time_in_seed true
  include_tag_in_seed true
</filter>

<match elb.access>
  @type elasticsearch
  hosts "#{ENV['FLUENT_ELASTICSEARCH_HOSTS']}"
  user "#{ENV['USER']}"
  password "#{ENV['PASSWORD']}"
  logstash_format true
  type_name fluentd
  id_key _hash
  remove_keys _hash
  ssl_verify false
  ssl_version TLSv1_2
  ca_file /fluentd/ssl/ca.crt
  logstash_prefix "#{ENV['APP_NAME']}-elb"
  include_timestamp true
  time_key date_time
  time_key_format %Y-%m-%d %H:%M:%S.%N
  suppress_type_name true
  request_timeout 120s
  reload_on_failure true
  reconnect_on_error true
  reload_connections false
  slow_flush_log_threshold 1200.0
  log_es_400_reason true
  <buffer>
    @type memory
    chunk_limit_size 256M
    total_limit_size 1024M
    flush_mode immediate
    flush_at_shutdown true
    overflow_action drop_oldest_chunk
    flush_thread_count 4
    retry_forever true
    retry_type exponential_backoff
    retry_max_interval 30
  </buffer>
</match>