Sha256: 5584709da9d93dc07d1ca250bdd3e1acb1832992492d0eaa0a31cb5a863fd14f

Contents?: true

Size: 1.22 KB

Versions: 59

Compression:

Stored size: 1.22 KB

Contents

# encoding: utf-8
require_relative "kibana_base"

module LogStash module Modules class KibanaSettings < KibanaBase
  include LogStash::Util::Loggable

  class Setting
    attr_reader :name, :value
    def initialize(name, value)
      @name, @value = name, value
    end
  end

  attr_reader :import_path, :content

  # content is an array of Setting required for this module
  def initialize(import_path, content)
    @import_path, @content = import_path, content
  end

  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
end end end

Version data entries

59 entries across 59 versions & 1 rubygems

Version Path
logstash-core-6.8.23-java lib/logstash/modules/kibana_settings.rb
logstash-core-6.8.22-java lib/logstash/modules/kibana_settings.rb
logstash-core-6.8.21-java lib/logstash/modules/kibana_settings.rb
logstash-core-6.8.20-java lib/logstash/modules/kibana_settings.rb
logstash-core-6.8.19-java lib/logstash/modules/kibana_settings.rb
logstash-core-6.8.18-java lib/logstash/modules/kibana_settings.rb
logstash-core-6.8.17-java lib/logstash/modules/kibana_settings.rb
logstash-core-6.8.16-java lib/logstash/modules/kibana_settings.rb
logstash-core-6.8.15-java lib/logstash/modules/kibana_settings.rb
logstash-core-6.8.14-java lib/logstash/modules/kibana_settings.rb
logstash-core-6.8.13-java lib/logstash/modules/kibana_settings.rb
logstash-core-6.8.12-java lib/logstash/modules/kibana_settings.rb
logstash-core-6.8.11-java lib/logstash/modules/kibana_settings.rb
logstash-core-6.8.10-java lib/logstash/modules/kibana_settings.rb
logstash-core-6.8.9-java lib/logstash/modules/kibana_settings.rb
logstash-core-6.8.8-java lib/logstash/modules/kibana_settings.rb
logstash-core-6.8.7-java lib/logstash/modules/kibana_settings.rb
logstash-core-7.5.2-java lib/logstash/modules/kibana_settings.rb
logstash-core-7.5.1-java lib/logstash/modules/kibana_settings.rb
logstash-core-6.8.6-java lib/logstash/modules/kibana_settings.rb