|
1 | 1 | <%- if @pure_array -%> |
2 | 2 | <%= scope['filebeat::inputs'].to_yaml() %> |
3 | 3 | <%- else -%> |
| 4 | +<%- if @input_type == 'filestream' |
| 5 | + parsers = @parsers |
| 6 | + if @multiline != {} |
| 7 | + parsers << {'multiline' => @multiline } |
| 8 | + end |
| 9 | + if @json != {} |
| 10 | + parsers << {'ndjson' => @json } |
| 11 | + end |
| 12 | +end -%> |
4 | 13 | --- |
5 | 14 | - type: <%= @input_type %> |
6 | 15 | <%- if @input_type =~ /(filestream|journald)/ -%> |
|
120 | 129 | <%- if @force_close_files -%> |
121 | 130 | force_close_files: <%= @force_close_files %> |
122 | 131 | <%- end -%> |
123 | | - <%- if @json.length > 0 -%> |
124 | | - ###JSON configuration |
| 132 | + <%- if @json != {} && @input_type != 'filestream'-%> |
| 133 | +###JSON configuration |
125 | 134 | json: |
126 | 135 | # Decode JSON options. Enable this if your logs are structured in JSON. |
127 | 136 | # JSON key on which to apply the line filtering and multiline settings. This key |
|
172 | 181 | ignore_decoding_error: <%= @json['ignore_decoding_error'] %> |
173 | 182 | <%- end -%> |
174 | 183 | <%- end -%> |
175 | | - <%- if @multiline.length > 0 -%> |
176 | | - <%- if @input_type == 'filestream' -%> |
| 184 | + <%- if parsers != [] -%> |
177 | 185 | parsers: |
178 | | - - multiline: |
179 | | - <%- if @multiline['pattern'] -%> |
180 | | - pattern: '<%= @multiline['pattern'] %>' |
181 | | - <%- end -%> |
182 | | - <%- if @multiline['negate'] -%> |
183 | | - negate: <%= @multiline['negate'] %> |
184 | | - <%- end -%> |
185 | | - <%- if @multiline['match'] -%> |
186 | | - match: <%= @multiline['match'] %> |
187 | | - <%- end -%> |
188 | | - <%- if @multiline['flush_pattern'] -%> |
189 | | - flush_pattern: <%= @multiline['flush_pattern'] %> |
190 | | - <%- end -%> |
191 | | - <%- if @multiline['max_lines'] -%> |
192 | | - max_lines: <%= @multiline['max_lines'] %> |
193 | | - <%- end -%> |
194 | | - <%- if @multiline['count_lines'] -%> |
195 | | - count_lines: <%= @multiline['count_lines'] %> |
196 | | - <%- end -%> |
197 | | - <%- if @multiline['timeout'] -%> |
198 | | - timeout: <%= @multiline['timeout'] %> |
199 | | - <%- end -%> |
200 | | - <%- if @multiline['skip_newline'] -%> |
201 | | - skip_newline: <%= @multiline['skip_newline'] %> |
202 | | - <%- end -%> |
203 | | - <%- else -%> |
| 186 | +<%= parsers.to_yaml.lines.drop(1).join.gsub(/^/, ' ') %> |
| 187 | + <%- end -%> |
| 188 | + <%- if @multiline != {} && @input_type != 'filestream' -%> |
204 | 189 | multiline: |
205 | 190 | <%- if @multiline['pattern'] -%> |
206 | 191 | pattern: '<%= @multiline['pattern'] %>' |
|
227 | 212 | skip_newline: <%= @multiline['skip_newline'] %> |
228 | 213 | <%- end -%> |
229 | 214 | <%- end -%> |
230 | | - <%- end -%> |
231 | 215 | tail_files: <%= @tail_files %> |
232 | 216 |
|
233 | 217 | # Experimental: If symlinks is enabled, symlinks are opened and harvested. The harvester is openening the |
|
0 commit comments