Skip to content

Commit ecb8260

Browse files
committed
[azure] Prevent pipeline script error
- prevent creating new HashMap with null - remove ignore_failure - improve error.message Relates #1789
1 parent d0dcc58 commit ecb8260

5 files changed

Lines changed: 27 additions & 10 deletions

File tree

packages/azure/changelog.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
# newer versions go on top
2+
- version: "0.9.2"
3+
changes:
4+
- description: Prevent pipeline script error
5+
type: bugfix
6+
link: https://github.com/elastic/integrations/pull/1870
27
- version: "0.9.1"
38
changes:
49
- description: Fix logic that checks for the 'forwarded' tag

packages/azure/data_stream/activitylogs/elasticsearch/ingest_pipeline/default.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,6 @@ processors:
213213
ignore_failure: true
214214
- script:
215215
lang: painless
216-
ignore_failure: true
217216
params:
218217
"write":
219218
type:
@@ -231,7 +230,11 @@ processors:
231230
if (ctx?.azure?.activitylogs?.category == null) {
232231
return;
233232
}
234-
def hm = new HashMap(params.get(ctx.azure.activitylogs.category.toLowerCase()));
233+
def category = ctx.azure.activitylogs.category.toLowerCase();
234+
if (params.get(category) == null) {
235+
return;
236+
}
237+
def hm = new HashMap(params.get(category));
235238
hm.forEach((k, v) -> ctx.event[k] = v);
236239
- geoip:
237240
field: source.ip
@@ -296,4 +299,5 @@ processors:
296299
on_failure:
297300
- set:
298301
field: error.message
299-
value: '{{ _ingest.on_failure_message }}'
302+
value: |-
303+
Processor "{{ _ingest.on_failure_processor_type }}" with tag "{{ _ingest.on_failure_processor_tag }}" in pipeline "{{ _ingest.on_failure_pipeline }}" failed with message "{{ _ingest.on_failure_message }}"

packages/azure/data_stream/platformlogs/elasticsearch/ingest_pipeline/default.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@ processors:
199199
ignore_missing: true
200200
- script:
201201
lang: painless
202-
ignore_failure: true
203202
params:
204203
"write":
205204
type:
@@ -217,7 +216,11 @@ processors:
217216
if (ctx?.azure?.platformlogs?.category == null) {
218217
return;
219218
}
220-
def hm = new HashMap(params.get(ctx.azure.platformlogs.category.toLowerCase()));
219+
def category = ctx.azure.platformlogs.category.toLowerCase();
220+
if (params.get(category) == null) {
221+
return;
222+
}
223+
def hm = new HashMap(params.get(category));
221224
hm.forEach((k, v) -> ctx.event[k] = v);
222225
- geoip:
223226
field: source.ip
@@ -255,4 +258,5 @@ processors:
255258
on_failure:
256259
- set:
257260
field: error.message
258-
value: '{{ _ingest.on_failure_message }}'
261+
value: |-
262+
Processor "{{ _ingest.on_failure_processor_type }}" with tag "{{ _ingest.on_failure_processor_tag }}" in pipeline "{{ _ingest.on_failure_pipeline }}" failed with message "{{ _ingest.on_failure_message }}"

packages/azure/data_stream/springcloudlogs/elasticsearch/ingest_pipeline/default.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,6 @@ processors:
246246
ignore_missing: true
247247
- script:
248248
lang: painless
249-
ignore_failure: true
250249
params:
251250
"write":
252251
type:
@@ -264,7 +263,11 @@ processors:
264263
if (ctx?.azure?.springcloudlogs?.category == null) {
265264
return;
266265
}
267-
def hm = new HashMap(params.get(ctx.azure.springcloudlogs.category.toLowerCase()));
266+
def category = ctx.azure.springcloudlogs.category.toLowerCase();
267+
if (params.get(category) == null) {
268+
return;
269+
}
270+
def hm = new HashMap(params.get(category));
268271
hm.forEach((k, v) -> ctx.event[k] = v);
269272
- geoip:
270273
field: source.ip
@@ -299,4 +302,5 @@ processors:
299302
on_failure:
300303
- set:
301304
field: error.message
302-
value: '{{ _ingest.on_failure_message }}'
305+
value: |-
306+
Processor "{{ _ingest.on_failure_processor_type }}" with tag "{{ _ingest.on_failure_processor_tag }}" in pipeline "{{ _ingest.on_failure_pipeline }}" failed with message "{{ _ingest.on_failure_message }}"

packages/azure/manifest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: azure
22
title: Azure Logs
3-
version: 0.9.1
3+
version: 0.9.2
44
release: beta
55
description: This Elastic integration collects logs from Azure
66
type: integration

0 commit comments

Comments
 (0)