mirror of
https://github.com/fluent/fluentd-ui.git
synced 2025-08-12 17:27:09 +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
|
def certain_format_line
|
||||||
case format
|
case format
|
||||||
when "grok"
|
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"
|
when "regexp"
|
||||||
"format #{regexp}"
|
"format #{regexp}"
|
||||||
else
|
else
|
||||||
@ -73,6 +73,15 @@ class Fluentd
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def grok
|
||||||
|
@grok ||=
|
||||||
|
begin
|
||||||
|
grok = GrokConverter.new
|
||||||
|
grok.load_patterns(Rails.root + "vendor/patterns")
|
||||||
|
grok
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def to_conf
|
def to_conf
|
||||||
# NOTE: Using strip_heredoc makes more complex for format_specific_conf indent
|
# NOTE: Using strip_heredoc makes more complex for format_specific_conf indent
|
||||||
<<-XML.gsub(/^[ ]*\n/m, "")
|
<<-XML.gsub(/^[ ]*\n/m, "")
|
||||||
|
Loading…
Reference in New Issue
Block a user