Class: LogStash::Modules::KibanaSettings
- Inherits:
-
KibanaBase
- Object
- KibanaBase
- LogStash::Modules::KibanaSettings
- Includes:
- Util::Loggable
- Defined in:
- lib/logstash/modules/kibana_settings.rb
Defined Under Namespace
Classes: Setting
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#import_path ⇒ Object
readonly
Returns the value of attribute import_path.
Instance Method Summary collapse
- #import(client) ⇒ Object
-
#initialize(import_path, content) ⇒ KibanaSettings
constructor
content is an array of Setting required for this module.
Methods inherited from KibanaBase
Constructor Details
#initialize(import_path, content) ⇒ KibanaSettings
content is an array of Setting required for this module
17 18 19 |
# File 'lib/logstash/modules/kibana_settings.rb', line 17 def initialize(import_path, content) @import_path, @content = import_path, content end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
14 15 16 |
# File 'lib/logstash/modules/kibana_settings.rb', line 14 def content @content end |
#import_path ⇒ Object (readonly)
Returns the value of attribute import_path.
14 15 16 |
# File 'lib/logstash/modules/kibana_settings.rb', line 14 def import_path @import_path end |
Instance Method Details
#import(client) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/logstash/modules/kibana_settings.rb', line 21 def import(client) # e.g. curl "http://localhost:5601/api/kibana/settings" # 6.0.0-beta1 -> {"settings":{"buildNum":{"userValue":15613},"defaultIndex":{"userValue":"arcsight-*"}}} # 5.4 -> {"settings":{"defaultIndex":{"userValue":"cef-*"},"metrics:max_buckets":{"userValue":"600000"}}} # array of Setting objects # The POST api body { "changes": { "defaultIndex": "arcsight-*", "metrics:max_buckets": "400" } } settings = {} content.each do |setting| settings[setting.name] = "#{setting.value}" end body = {"changes" => settings} response = client.post(import_path, body) if response.failed? logger.error("Attempted POST failed", :url_path => import_path, :response => response.body) end response end |