Multi dimension filter for logstash-input-cloudwatch plugin

I get a error message hen I using the logstash-input-cloudwatch to retrieve the metric with Multi dimension.
Not sure the filters format is correct or not.

config

  cloudwatch {
    namespace => "sqlserver"
    metrics => [
        "FreeableMemory"
    ]
    filters =>  [{host => Remedy}, {objectname => Memory}]
    region => "ap-northeast-1"
    interval => 600
    period => 300
  }

Error message

[2019-01-10T10:44:27,228][ERROR][logstash.pipeline        ] A plugin had an unrecoverable error. Will restart this plugin.
  Pipeline_id:main
  Plugin: <LogStash::Inputs::CloudWatch  period=>300, namespace=>"sqlserver", nterval=>600, metrics=>["FreeableMemory"], filters=>[{"host"=>"Remedy"}, {"objectname"=>"Memory"}], id=>"59329e8a6b9e99e6ac1185964ba6189ff5991ad940c0730d7dbce9bf5619b3ce", region=>"ap-northeast-1", enable_metric=>true, codec=><LogStash::Codecs::Plain id=>"plain_e1b0bc86-8438-4b26-9770-32635ea6bfd1", enable_metric=>true, charset=>"UTF-8">, role_session_name=>"logstash", statistics=>["SampleCount", "Average", "Minimum", "Maximum", "Sum"], combined=>false>
  Error: undefined method `each_pair' for [{"host"=>"Remedy"}, {"objectname"=>"Memory"}]:Array
Did you mean?  each_entry
  Exception: NoMethodError
  Stack: /usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-input-cloudwatch-2.2.4/lib/logstash/inputs/cloudwatch.rb:179:in `from_resources'
/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-input-cloudwatch-2.2.4/lib/logstash/inputs/cloudwatch.rb:163:in `block in run'
org/jruby/RubyArray.java:1734:in `each'
/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-input-cloudwatch-2.2.4/lib/logstash/inputs/cloudwatch.rb:157:in `run'
/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:409:in `inputworker'
/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:403:in `block in start_input'

If you look at the code, it is calling each_pair against resources. each_pair is a function of a hash. For your namespace, resources is @filters.

Filters is documented as taking an array, but all the examples show a hash. Array and hash are sometimes, but not always, interchangeable.

What do you get if you set

filters =>  {host => Remedy objectname => Memory}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.