From f4381a81fdbc7be4fde30dcb90054f3d44a52c5d Mon Sep 17 00:00:00 2001 From: yoshihara Date: Tue, 21 Apr 2015 12:12:47 +0900 Subject: [PATCH] Use constant for magic number --- app/models/fluentd/setting/in_tail.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/models/fluentd/setting/in_tail.rb b/app/models/fluentd/setting/in_tail.rb index 044815b..1d160bb 100644 --- a/app/models/fluentd/setting/in_tail.rb +++ b/app/models/fluentd/setting/in_tail.rb @@ -1,6 +1,8 @@ class Fluentd module Setting class InTail + MULTI_LINE_MAX_FORMAT_COUNT = 20 + include ActiveModel::Model attr_accessor :path, :tag, :format, :regexp, :time_format, :rotate_wait, :pos_file, :read_from_head, :refresh_interval @@ -18,7 +20,7 @@ class Fluentd :ltsv => [:delimiter, :time_key], :json => [:time_key], :regexp => [:time_format, :regexp], - :multiline => [:format_firstline] + (1..20).map{|n| "format#{n}".to_sym } + :multiline => [:format_firstline] + (1..MULTI_LINE_MAX_FORMAT_COUNT).map{|n| "format#{n}".to_sym } # TODO: Grok could generate Regexp including \d, \s, etc. fluentd config parser raise error with them for escape sequence check. # TBD How to handle Grok/Regexp later, just comment out for hide # :grok => [:grok_str],