mirror of
https://github.com/fluent/fluentd-ui.git
synced 2025-08-10 08:17:06 +02:00
Grok convert to Regexp for config file
This commit is contained in:
parent
a8e979fc7c
commit
61dc3da127
@ -65,7 +65,7 @@ class Fluentd
|
||||
def certain_format_line
|
||||
case format
|
||||
when "grok"
|
||||
"format #{grok_str} # grok: #{grok_str}" # TODO: convert to regexp
|
||||
"format /#{grok.convert_to_regexp(grok_str).source.gsub("/", "\\/")}/ # grok: '#{grok_str}'" # TODO: convert to regexp
|
||||
when "regexp"
|
||||
"format #{regexp}"
|
||||
else
|
||||
@ -73,6 +73,15 @@ class Fluentd
|
||||
end
|
||||
end
|
||||
|
||||
def grok
|
||||
@grok ||=
|
||||
begin
|
||||
grok = GrokConverter.new
|
||||
grok.load_patterns(Rails.root + "vendor/patterns")
|
||||
grok
|
||||
end
|
||||
end
|
||||
|
||||
def to_conf
|
||||
# NOTE: Using strip_heredoc makes more complex for format_specific_conf indent
|
||||
<<-XML.gsub(/^[ ]*\n/m, "")
|
||||
|
Loading…
Reference in New Issue
Block a user