72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
|
# File 'lib/fluent/plugin/filter_concat.rb', line 72
def configure(conf)
super
params, names = required_params
if params.all?
raise Fluent::ConfigError, "Either #{[names[0..-2].join(", "), names[-1]].join(" or ")} is required"
end
if @n_lines && (@multiline_start_regexp || @multiline_end_regexp)
raise Fluent::ConfigError, "n_lines and multiline_start_regexp/multiline_end_regexp are exclusive"
end
if @partial_key && @n_lines
raise Fluent::ConfigError, "partial_key and n_lines are exclusive"
end
if @partial_key && (@multiline_start_regexp || @multiline_end_regexp)
raise Fluent::ConfigError, "partial_key and multiline_start_regexp/multiline_end_regexp are exclusive"
end
if @partial_key && @partial_value.nil?
raise Fluent::ConfigError, "partial_value is required when partial_key is specified"
end
if @use_partial_metadata && @n_lines
raise Fluent::ConfigError, "use_partial_metadata and n_lines are exclusive"
end
if @use_partial_metadata && (@multiline_start_regexp || @multiline_end_regexp)
raise Fluent::ConfigError, "use_partial_metadata and multiline_start_regexp/multiline_end_regexp are exclusive"
end
if @use_partial_metadata && @partial_key
raise Fluent::ConfigError, "use_partial_metadata and partial_key are exclusive"
end
if @use_partial_cri_logtag && @n_lines
raise Fluent::ConfigError, "use_partial_cri_logtag and n_lines are exclusive"
end
if @use_partial_cri_logtag && (@multiline_start_regexp || @multiline_end_regexp)
raise Fluent::ConfigError, "use_partial_cri_logtag and multiline_start_regexp/multiline_end_regexp are exclusive"
end
if @use_partial_cri_logtag && @partial_key
raise Fluent::ConfigError, "use_partial_cri_logtag and partial_key are exclusive"
end
@mode = nil
case
when @n_lines
@mode = :line
when @partial_key
@mode = :partial
when @use_partial_metadata
@mode = :partial_metadata
case @partial_metadata_format
when :"docker-fluentd"
@partial_message_field = "partial_message".freeze
@partial_id_field = "partial_id".freeze
@partial_ordinal_field = "partial_ordinal".freeze
@partial_last_field = "partial_last".freeze
@partial_message_indicator = @partial_message_field
when :"docker-journald"
@partial_message_field = "CONTAINER_PARTIAL_MESSAGE".freeze
@partial_id_field = "CONTAINER_PARTIAL_ID".freeze
@partial_ordinal_field = "CONTAINER_PARTIAL_ORDINAL".freeze
@partial_last_field = "CONTAINER_PARTIAL_LAST".freeze
@partial_message_indicator = @partial_id_field
when :"docker-journald-lowercase"
@partial_message_field = "container_partial_message".freeze
@partial_id_field = "container_partial_id".freeze
@partial_ordinal_field = "container_partial_ordinal".freeze
@partial_last_field = "container_partial_last".freeze
@partial_message_indicator = @partial_id_field
end
when @use_partial_cri_logtag
@mode = :partial_cri
@partial_logtag_delimiter = ":".freeze
@partial_logtag_continue = "P".freeze
@partial_logtag_full = "F".freeze
when @multiline_start_regexp || @multiline_end_regexp
@mode = :regexp
if @multiline_start_regexp
@multiline_start_regexp = Regexp.compile(@multiline_start_regexp[1..-2])
end
if @multiline_end_regexp
@multiline_end_regexp = Regexp.compile(@multiline_end_regexp[1..-2])
end
if @continuous_line_regexp
@continuous_line_regexp = Regexp.compile(@continuous_line_regexp[1..-2])
end
end
end
|