Skip to content

Commit 5e6a25e

Browse files
Template ssl correction (#322)
1 parent 5044e3d commit 5e6a25e

File tree

1 file changed

+71
-67
lines changed

1 file changed

+71
-67
lines changed

templates/input.yml.erb

Lines changed: 71 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,15 @@
88
<%- end -%>
99
<%- if @input_type =~ /(tcp|udp)/ -%>
1010
host: <%= @host %>
11-
<%- if @max_message_size -%>
11+
<%- if @ssl.length > 0 -%>
12+
ssl:
13+
<%- @ssl.each_pair do |k, v| -%>
14+
<%= k %>: <%= v %>
15+
<%- end -%>
16+
<%- end -%>
17+
<%- if @max_message_size -%>
1218
max_message_size: <%= @max_message_size %>
13-
<%- end -%>
19+
<%- end -%>
1420
<%- elsif @input_type == 'docker' -%>
1521
containers:
1622
ids:
@@ -24,77 +30,84 @@
2430
<%- elsif @input_type == 'syslog' -%>
2531
protocol.<%= @syslog_protocol %>:
2632
host: <%= @syslog_host %>
33+
<%- if @ssl.length > 0 -%>
34+
ssl:
35+
<%- @ssl.each_pair do |k, v| -%>
36+
<%= k %>: <%= v %>
37+
<%- end -%>
38+
<%- end -%>
2739
<%- elsif @input_type == 'journald' -%>
28-
<%- if @seek -%>
40+
<%- if @seek -%>
2941
seek: <%= @seek %>
30-
<%- end -%>
31-
<%- if @include_matches.length > 0 -%>
42+
<%- end -%>
43+
<%- if @include_matches.length > 0 -%>
3244
include_matches:
33-
<%- @include_matches.each do |match| -%>
45+
<%- @include_matches.each do |match| -%>
3446
- <%= match %>
47+
<%- end -%>
3548
<%- end -%>
36-
<%- end -%>
3749
<%- else -%>
3850
paths:
39-
<%- @paths.each do |log_path| -%>
51+
<%- @paths.each do |log_path| -%>
4052
- <%= log_path %>
41-
<%- end -%>
42-
<%- if @encoding -%>
53+
<%- end -%>
54+
<%- if @encoding -%>
4355
encoding: <%= @encoding %>
44-
<%- end -%>
45-
<%- if @include_lines.length > 0 -%>
56+
<%- end -%>
57+
<%- if @include_lines.length > 0 -%>
4658
include_lines:
47-
<%- @include_lines.each do |include_line| -%>
59+
<%- @include_lines.each do |include_line| -%>
4860
- '<%= include_line %>'
61+
<%- end -%>
4962
<%- end -%>
50-
<%- end -%>
51-
<%- if @exclude_lines.length > 0 -%>
63+
<%- if @exclude_lines.length > 0 -%>
5264
exclude_lines:
53-
<%- @exclude_lines.each do |exclude_line| -%>
65+
<%- @exclude_lines.each do |exclude_line| -%>
5466
- '<%= exclude_line %>'
67+
<%- end -%>
5568
<%- end -%>
56-
<%- end -%>
57-
<%- if @input_type != 'filestream' -%>
58-
<%- if @exclude_files.length > 0 -%>
69+
<%- if @input_type != 'filestream' -%>
70+
<%- if @exclude_files.length > 0 -%>
5971
exclude_files:
60-
<%- @exclude_files.each do |exclude_file| -%>
72+
<%- @exclude_files.each do |exclude_file| -%>
6173
- <%= exclude_file %>
74+
<%- end -%>
6275
<%- end -%>
6376
<%- end -%>
64-
<%- end -%>
65-
<%- if @ignore_older -%>
77+
<%- if @ignore_older -%>
6678
ignore_older: <%= @ignore_older %>
67-
<%- end -%>
68-
<%- if @doc_type -%>
79+
<%- end -%>
80+
<%- if @doc_type -%>
6981
document_type: <%= @doc_type %>
82+
<%- end -%>
7083
<%- end -%>
71-
<%- if @scan_frequency or @exclude_files -%>
72-
<%- if @input_type == 'filestream' -%>
84+
<%- if @scan_frequency or @exclude_files -%>
85+
<%- if @input_type == 'filestream' -%>
7386
prospector:
7487
scanner:
75-
<%- if @scan_frequency -%>
88+
<%- if @scan_frequency -%>
7689
check_interval: <%= @scan_frequency %>
77-
<%- end -%>
78-
<%- if @exclude_files.length > 0 -%>
90+
<%- end -%>
91+
<%- if @exclude_files.length > 0 -%>
7992
exclude_files:
80-
<%- @exclude_files.each do |exclude_file| -%>
93+
<%- @exclude_files.each do |exclude_file| -%>
8194
- <%= exclude_file %>
82-
<%- end -%>
8395
<%- end -%>
84-
<%- else -%>
96+
<%- end -%>
97+
<%- else -%>
8598
scan_frequency: <%= @scan_frequency %>
99+
<%- end -%>
86100
<%- end -%>
87-
<%- end -%>
88101
<%- if @harvester_buffer_size -%>
89102
harvester_buffer_size: <%= @harvester_buffer_size %>
90103
<%- end -%>
91-
<%- if @max_bytes -%>
92-
<%- if @input_type == 'filestream' -%>
104+
<%- if @max_bytes -%>
105+
<%- if @input_type == 'filestream' -%>
93106
message_max_bytes: <%= @max_bytes %>
94-
<%- else -%>
107+
<%- else -%>
95108
max_bytes: <%= @max_bytes %>
109+
<%- end -%>
96110
<%- end -%>
97-
<%- end -%>
98111
<%- if @symlinks -%>
99112
symlinks: <%= @symlinks %>
100113
<%- end -%>
@@ -104,15 +117,14 @@
104117
<%- if @force_close_files -%>
105118
force_close_files: <%= @force_close_files %>
106119
<%- end -%>
107-
108120
<%- if @json.length > 0 -%>
109-
### JSON configuration
121+
###JSON configuration
110122
json:
111123
# Decode JSON options. Enable this if your logs are structured in JSON.
112124
# JSON key on which to apply the line filtering and multiline settings. This key
113125
# must be top level and its value must be string, otherwise it is ignored. If
114126
# no text key is defined, the line filtering and multiline features cannot be used.
115-
<%- if @json['message_key'] != nil-%>
127+
<%- if @json['message_key'] != nil -%>
116128
message_key: '<%= @json['message_key'] %>'
117129
<%- end -%>
118130

@@ -136,9 +148,8 @@
136148
add_error_key: <%= @json['add_error_key'] %>
137149
<%- end -%>
138150
<%- end -%>
139-
140-
<%- if @multiline.length > 0 -%>
141-
<%- if @input_type == 'filestream' -%>
151+
<%- if @multiline.length > 0 -%>
152+
<%- if @input_type == 'filestream' -%>
142153
parsers:
143154
- multiline:
144155
<%- if @multiline['pattern'] -%>
@@ -156,25 +167,25 @@
156167
<%- if @multiline['timeout'] -%>
157168
timeout: <%= @multiline['timeout'] %>
158169
<%- end -%>
159-
<%- else -%>
170+
<%- else -%>
160171
multiline:
161-
<%- if @multiline['pattern'] -%>
172+
<%- if @multiline['pattern'] -%>
162173
pattern: '<%= @multiline['pattern'] %>'
163-
<%- end -%>
164-
<%- if @multiline['negate'] -%>
174+
<%- end -%>
175+
<%- if @multiline['negate'] -%>
165176
negate: <%= @multiline['negate'] %>
166-
<%- end -%>
167-
<%- if @multiline['match'] -%>
177+
<%- end -%>
178+
<%- if @multiline['match'] -%>
168179
match: <%= @multiline['match'] %>
169-
<%- end -%>
170-
<%- if @multiline['max_lines'] -%>
180+
<%- end -%>
181+
<%- if @multiline['max_lines'] -%>
171182
max_lines: <%= @multiline['max_lines'] %>
172-
<%- end -%>
173-
<%- if @multiline['timeout'] -%>
183+
<%- end -%>
184+
<%- if @multiline['timeout'] -%>
174185
timeout: <%= @multiline['timeout'] %>
186+
<%- end -%>
175187
<%- end -%>
176188
<%- end -%>
177-
<%- end -%>
178189
tail_files: <%= @tail_files %>
179190

180191
# Experimental: If symlinks is enabled, symlinks are opened and harvested. The harvester is openening the
@@ -246,7 +257,6 @@
246257
<%- if @close_timeout -%>
247258
close_timeout: <%= @close_timeout %>
248259
<%- end -%>
249-
<%- end -%>
250260
<%- # Everything below this can be applied to any input. -%>
251261
<%- # https://www.elastic.co/guide/en/beats/filebeat/current/configuration-general-options.html#configuration-general -%>
252262
<%- if @pipeline -%>
@@ -259,20 +269,14 @@
259269
<%- end -%>
260270
<%- end -%>
261271
fields_under_root: <%= @fields_under_root %>
262-
<%- unless @facts['filebeat_version'] == false -%>
263-
<%- if scope.function_versioncmp([@facts['filebeat_version'], '7.5']) > 0 -%>
264-
<%- if @index -%>
272+
<%- unless @facts['filebeat_version'] == false -%>
273+
<%- if scope.function_versioncmp([@facts['filebeat_version'], '7.5']) > 0 -%>
274+
<%- if @index -%>
265275
index: <%= @index %>
266-
<%- end -%>
267-
<%- if @keep_null -%>
276+
<%- end -%>
277+
<%- if @keep_null -%>
268278
keep_null: <%= @keep_null %>
269-
<%- end -%>
270-
<%- end -%>
271-
<%- end -%>
272-
<%- if @ssl.length > 0 -%>
273-
ssl:
274-
<%- @ssl.each_pair do |k, v| -%>
275-
<%= k %>: <%= v %>
279+
<%- end -%>
276280
<%- end -%>
277281
<%- end -%>
278282
<%- if @tags.length > 0 -%>

0 commit comments

Comments
 (0)