Class: LogStash::Config::Source::Local

Inherits:
Base
  • Object
show all
Defined in:
lib/logstash/config/source/local.rb

Overview

A locally defined configuration source

Which can aggregate the following config options:

- settings.config_string: "input { stdin {} }"
- settings.config_path: /tmp/logstash/*.conf
- settings.config_path: http://localhost/myconfig.conf

All theses option will create a unique pipeline, generated parts will be
sorted alphabetically. Se `PipelineConfig` class for the sorting algorithm.

Direct Known Subclasses

MultiLocal

Defined Under Namespace

Classes: ConfigPathLoader, ConfigRemoteLoader, ConfigStringLoader

Constant Summary collapse

PIPELINE_ID =
LogStash::SETTINGS.get("pipeline.id").to_sym
HTTP_RE =
/^http(s)?/

Instance Attribute Summary

Attributes inherited from Base

#conflict_messages

Instance Method Summary collapse

Methods inherited from Base

#both_module_configs?, #config_path, #config_path?, #config_path_setting, #config_reload_automatic, #config_reload_automatic?, #config_reload_automatic_setting, #config_string, #config_string?, #config_string_setting, #initialize, #modules, #modules?, #modules_cli, #modules_cli?, #modules_cli_setting, #modules_defined?, #modules_setting

Constructor Details

This class inherits a constructor from LogStash::Config::Source::Base

Instance Method Details

#config_conflict?Boolean

Returns:

  • (Boolean)


169
170
171
172
173
174
175
176
177
178
179
180
181
182
# File 'lib/logstash/config/source/local.rb', line 169

def config_conflict?
  @conflict_messages.clear

  # Check if configuration auto-reload is used that -f is specified
  if automatic_reload_with_config_string?
    @conflict_messages << I18n.t("logstash.runner.reload-with-config-string")
  end
  # Check if both -f and -e are present
  if config_string? && config_path?
    @conflict_messages << I18n.t("logstash.runner.config-string-path-exclusive")
  end

  @conflict_messages.any?
end

#match?Boolean

Returns:

  • (Boolean)


164
165
166
167
# File 'lib/logstash/config/source/local.rb', line 164

def match?
  # see basic settings predicates and getters defined in the base class
  (config_string? || config_path?) && !(modules_cli? || modules?) && !automatic_reload_with_config_string?
end

#pipeline_configsObject



157
158
159
160
161
162
# File 'lib/logstash/config/source/local.rb', line 157

def pipeline_configs
  if config_conflict?
    raise ConfigurationError, @conflict_messages.join(", ")
  end
  local_pipeline_configs
end