Module: Fluent::Auditify::Plugin::YamlConfSyntaxErrorParser

Included in:
YamlConf
Defined in:
lib/fluent/auditify/plugin/parse_fallback.rb

Instance Method Summary collapse

Instance Method Details

#detect_wrong_at_directive_syntax(conf) ⇒ Object

config:

- source:
    @type: forward


10
11
12
13
14
15
16
17
18
19
20
# File 'lib/fluent/auditify/plugin/parse_fallback.rb', line 10

def detect_wrong_at_directive_syntax(conf)
  file_readlines_each(conf) do |line, i|
    strip_line = line.strip
    next unless strip_line.start_with?('@')
    if %w(@type @label @tag @arg @name @log_level).any? { |v| strip_line.start_with?(v) }
      at_directive = /@(.+?):.*/.match(strip_line).to_a[1]
      guilty(:error, "use '$#{at_directive}' special YAML element instead of '@#{at_directive}'",
             { path: conf, line: i + 1, content: line})
    end
  end
end