Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Logstash throws unexpected error: <ArgumentError: Setting "" hasn't been registered>,

Tags:

jmx

logstash

I followed instruction: https://www.elastic.co/guide/en/logstash/current/plugins-inputs-jmx.html

to setup cassandra jmx metric monitoring.

My logstash.yml is as follows:

input {
    jmx {
        path => "/home/foo/elastic/logstash"
        polling_frequency => 15
        type => "jmx"
        nb_thread => 4
    }
}

output {
    stdout { codec => rubydebug }
}

Under /home/foo/elastic/logstash, I define a jmx.conf file with following info:

//Required, JMX listening host/ip
"host" : "192.168.1.139",
//Required, JMX listening port
"port" : 7199,
//Optional, the username to connect to JMX
"username" : "foo",
//Optional, the password to connect to JMX
"password": "foo",
//Optional, use this alias as a prefix in the metric name. If not set use <host>_<port>
"alias" : "cassandra",

Then I run logstash in the command:

sudo bin/logstash -f /etc/logstash/logstash.yml --path.settings /etc/logstash --debug

I get the following error:

Sending Logstash's logs to /usr/share/logstash/logs which is now configured via log4j2.properties

[FATAL] 2017-10-28 22:57:23.812 [main] runner - An unexpected error occurred! {:error=>#, :backtrace=>["/usr/share/logstash/logstash-core/lib/logstash/settings.rb:32:in get_setting'", "/usr/share/logstash/logstash-core/lib/logstash/settings.rb:64:inset_value'", "/usr/share/logstash/logstash-core/lib/logstash/settings.rb:83:in merge'", "org/jruby/RubyHash.java:1342:ineach'", "/usr/share/logstash/logstash-core/lib/logstash/settings.rb:83:in merge'", "/usr/share/logstash/logstash-core/lib/logstash/settings.rb:135:invalidate_all'", "/usr/share/logstash/logstash-core/lib/logstash/runner.rb:243:in execute'", "/usr/share/logstash/vendor/bundle/jruby/1.9/gems/clamp-0.6.5/lib/clamp/command.rb:67:inrun'", "/usr/share/logstash/logstash-core/lib/logstash/runner.rb:204:in run'", "/usr/share/logstash/vendor/bundle/jruby/1.9/gems/clamp-0.6.5/lib/clamp/command.rb:132:inrun'", "/usr/share/logstash/lib/bootstrap/environment.rb:71:in `(root)'"]}

like image 220
Happy Avatar asked Nov 30 '25 05:11

Happy


2 Answers

I figure it out myself.

There are 2 types of settings for Logstash, one is for Logstash, one for pipeline. Typically the one in /etc/logstash is for Logstash, and pipeline one is in /etc/logstash/conf.d. I used pipeline one for Logstash, which creates all errors.

like image 51
Happy Avatar answered Dec 02 '25 03:12

Happy


The Problem

The error message is not pretty clear but the logstash.yml file should contains data in YAML format. And here it doesn't (Your data input { jmx { path => ... is clearly not on YAML format.

Why does it matter ?

Because Logstash has two types of configuration files:

  • pipeline configuration files with the .conf extension which define the Logstash processing pipeline and
  • settings files, which specify options that control Logstash startup and execution. ( logstash.yml, pipelines.yml, jvm.options, etc...). This means :
  1. If You want to configure data input, filter or output, you should put your configuration in a logstash.conf file (or in a file having a .conf extension)
  2. If you want to configure logstash and you do not want to pass options or flags at the command line level, you can set them here in logstash.yml.

How to fix it ?

  1. You can ignore (or delete) the file /etc/logstash/logstash.yml if you do not have any option to pass to set logstash startup behaviour.
  2. Set the content of the file /etc/logstash/pipelines.yml to the following
# This file is where you define your pipelines. You can define multiple.
# For more information on multiple pipelines, see the documentation:
#   https://www.elastic.co/guide/en/logstash/current/multiple-pipelines.html

- pipeline.id: main
  path.config: "/etc/logstash/conf.d/*.conf"
  1. Put your logstash data configuration pipeline in the file /etc/logstash/conf.d/logstash.conf as following
input {
    jmx {
        path => "/home/foo/elastic/logstash"
        polling_frequency => 15
        type => "jmx"
        nb_thread => 4
    }
}

output {
    stdout { codec => rubydebug }
}

Et voilà :=)

like image 41
Maestro Avatar answered Dec 02 '25 04:12

Maestro



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!