Skip to content

Commit

Permalink
sdd_all: use triple-brace templating in complex templates (#11315)
Browse files Browse the repository at this point in the history
This is a second pass at replacing double brace template marks with triple brace
marks. It addresses more complex uses that the sed rewrite did not find by using
PCRE via perl.

[git-generate]
for f in $(
	(
		for p in $(
			yq 'select(.owner.github == "elastic/sec-deployment-and-devices")|.name' packages/**/manifest.yml \
			| grep -v -- '---'
		); do
			rg -l -g '*.yml' "[^{]\{\{[^{][ .a-zA-Z0-9_]*[^}]}}[^}]" packages/$p
		done
	)|grep "elasticsearch/ingest_pipeline"|sort|uniq
); do
	perl -pi -e 's/(?<!\{)(\{\{[^{][ .a-zA-Z0-9_]*[^}]}})(?!\})/{$1}/g' $f
done
for p in $(git diff --name-only HEAD~1|cut -d/ -f1,2|sort|uniq); do
	(
		cd $p
		elastic-package test pipeline -g
		elastic-package changelog add \
			--description "Use triple-brace Mustache templating when referencing variables in ingest pipelines." \
			--type bugfix \
			--next patch \
			--link #11315
	)>/dev/null 2>&1
done
  • Loading branch information
efd6 authored Oct 8, 2024
1 parent 26029a5 commit 2621bb0
Show file tree
Hide file tree
Showing 56 changed files with 169 additions and 104 deletions.
5 changes: 5 additions & 0 deletions packages/cef/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# newer versions go on top
- version: "2.17.4"
changes:
- description: Use triple-brace Mustache templating when referencing variables in ingest pipelines.
type: bugfix
link: https://github.com/elastic/integrations/pull/11315
- version: "2.17.3"
changes:
- description: Use triple-brace Mustache templating when referencing variables in ingest pipelines.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ on_failure:
- append:
field: error.message
value: |-
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 }}"
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 }}}"
- set:
field: event.kind
value: pipeline_error
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ on_failure:
- append:
field: error.message
value: |-
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 }}"
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 }}}"
- set:
field: event.kind
value: pipeline_error
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ on_failure:
- append:
field: error.message
value: |-
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 }}"
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 }}}"
- set:
field: event.kind
value: pipeline_error
2 changes: 1 addition & 1 deletion packages/cef/manifest.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: cef
title: Common Event Format (CEF)
version: "2.17.3"
version: "2.17.4"
description: Collect logs from CEF Logs with Elastic Agent.
categories:
- security
Expand Down
5 changes: 5 additions & 0 deletions packages/checkpoint/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# newer versions go on top
- version: "1.34.2"
changes:
- description: Use triple-brace Mustache templating when referencing variables in ingest pipelines.
type: bugfix
link: https://github.com/elastic/integrations/pull/11315
- version: "1.34.1"
changes:
- description: Use triple-brace Mustache templating when referencing variables in ingest pipelines.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ processors:
field: error.message
value: "fail-{{{ _ingest.on_failure_processor_tag }}}"
- fail:
message: "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 }}"
message: "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 }}}"
- kv:
tag: "kv_syslog_structured_semicolon_colon"
field: syslog5424_sd
Expand All @@ -52,7 +52,7 @@ processors:
field: error.message
value: "fail-{{{ _ingest.on_failure_processor_tag }}}"
- fail:
message: "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 }}"
message: "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 }}}"
- grok:
field: syslog5424_sd
if: ctx.checkpoint == null
Expand Down Expand Up @@ -86,7 +86,7 @@ processors:
field: error.message
value: "fail-{{{ _ingest.on_failure_processor_tag }}}"
- fail:
message: "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 }}"
message: "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 }}}"
- foreach:
field: checkpoint
ignore_missing: true
Expand Down Expand Up @@ -160,7 +160,7 @@ processors:
field: error.message
value: "fail-{{{ _ingest.on_failure_processor_tag }}}"
- fail:
message: "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 }}"
message: "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 }}}"
# Some log events lack loguid and time, so to avoid potential
# collisions hash the complete line in those rare cases.
- fingerprint:
Expand Down Expand Up @@ -1066,7 +1066,7 @@ processors:
field: error.message
value: "fail-{{{ _ingest.on_failure_processor_tag }}}"
- fail:
message: "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 }}"
message: "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 }}}"
- rename:
field: checkpoint._temp_unixms
target_field: "@timestamp"
Expand Down
2 changes: 1 addition & 1 deletion packages/checkpoint/manifest.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: checkpoint
title: Check Point
version: "1.34.1"
version: "1.34.2"
description: Collect logs from Check Point with Elastic Agent.
type: integration
format_version: "3.0.3"
Expand Down
5 changes: 5 additions & 0 deletions packages/cisco_ftd/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# newer versions go on top
- version: "3.4.3"
changes:
- description: Use triple-brace Mustache templating when referencing variables in ingest pipelines.
type: bugfix
link: https://github.com/elastic/integrations/pull/11315
- version: "3.4.2"
changes:
- description: "Fix grok failure with username with spaces on ftd messageID."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1815,7 +1815,7 @@ processors:
field: error.message
value: "fail-{{{ _ingest.on_failure_processor_tag }}}"
- fail:
message: "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 }}"
message: "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 }}}"
- grok:
field: "destination.user.name"
tag: "grok_destination_user_name"
Expand All @@ -1833,7 +1833,7 @@ processors:
field: error.message
value: "fail-{{{ _ingest.on_failure_processor_tag }}}"
- fail:
message: "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 }}"
message: "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 }}}"
#
# Normalize protocol names
Expand Down
2 changes: 1 addition & 1 deletion packages/cisco_ftd/manifest.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
format_version: "3.0.3"
name: cisco_ftd
title: Cisco FTD
version: "3.4.2"
version: "3.4.3"
description: Collect logs from Cisco FTD with Elastic Agent.
type: integration
categories:
Expand Down
5 changes: 5 additions & 0 deletions packages/cisco_ios/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# newer versions go on top
- version: "1.27.2"
changes:
- description: Use triple-brace Mustache templating when referencing variables in ingest pipelines.
type: bugfix
link: https://github.com/elastic/integrations/pull/11315
- version: "1.27.1"
changes:
- description: Handle timestamp starting with the year such as 'yyyy MMM d HH:mm:ss.SSS z'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ on_failure:
- append:
field: error.message
value: |-
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 }}"
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 }}}"
- set:
field: event.kind
value: pipeline_error
2 changes: 1 addition & 1 deletion packages/cisco_ios/manifest.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
format_version: "3.0.3"
name: cisco_ios
title: Cisco IOS
version: "1.27.1"
version: "1.27.2"
description: Collect logs from Cisco IOS with Elastic Agent.
type: integration
categories:
Expand Down
5 changes: 5 additions & 0 deletions packages/cisco_ise/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# newer versions go on top
- version: "1.23.2"
changes:
- description: Use triple-brace Mustache templating when referencing variables in ingest pipelines.
type: bugfix
link: https://github.com/elastic/integrations/pull/11315
- version: "1.23.1"
changes:
- description: Use triple-brace Mustache templating when referencing variables in ingest pipelines.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,6 @@ on_failure:
- append:
field: error.message
value: >-
Processor '{{ _ingest.on_failure_processor_type }}'
{{#_ingest.on_failure_processor_tag}}with tag '{{ _ingest.on_failure_processor_tag }}'
{{/_ingest.on_failure_processor_tag}}failed with message '{{ _ingest.on_failure_message }}'
Processor '{{{ _ingest.on_failure_processor_type }}}'
{{{#_ingest.on_failure_processor_tag}}}with tag '{{{ _ingest.on_failure_processor_tag }}}'
{{{/_ingest.on_failure_processor_tag}}}failed with message '{{{ _ingest.on_failure_message }}}'
2 changes: 1 addition & 1 deletion packages/cisco_ise/manifest.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
format_version: "3.0.3"
name: cisco_ise
title: Cisco ISE
version: "1.23.1"
version: "1.23.2"
description: Collect logs from Cisco ISE with Elastic Agent.
type: integration
categories:
Expand Down
5 changes: 5 additions & 0 deletions packages/cisco_secure_email_gateway/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# newer versions go on top
- version: "1.24.1"
changes:
- description: Use triple-brace Mustache templating when referencing variables in ingest pipelines.
type: bugfix
link: https://github.com/elastic/integrations/pull/11315
- version: "1.24.0"
changes:
- description: "Allow @custom pipeline access to event.original without setting preserve_original_event."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -534,4 +534,4 @@ on_failure:
- append:
field: error.message
value: |-
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 }}"
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 }}}"
2 changes: 1 addition & 1 deletion packages/cisco_secure_email_gateway/manifest.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
format_version: "3.0.3"
name: cisco_secure_email_gateway
title: Cisco Secure Email Gateway
version: "1.24.0"
version: "1.24.1"
description: Collect logs from Cisco Secure Email Gateway with Elastic Agent.
type: integration
categories:
Expand Down
5 changes: 5 additions & 0 deletions packages/goflow2/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# newer versions go on top
- version: "0.1.1"
changes:
- description: Use triple-brace Mustache templating when referencing variables in ingest pipelines.
type: bugfix
link: https://github.com/elastic/integrations/pull/11315
- version: "0.1.0"
changes:
- description: Initial version of the package
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ processors:
on_failure:
- set:
field: error.message
value: 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
}} - Source {{_source}}
value: 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
}} - Source {{{_source}}}
tag: set_error_message_on_failure
2 changes: 1 addition & 1 deletion packages/goflow2/manifest.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
format_version: 3.2.1
name: goflow2
title: "GoFlow2 logs"
version: 0.1.0
version: 0.1.1
description: "Collect logs from goflow2 with Elastic Agent."
type: integration
categories:
Expand Down
5 changes: 5 additions & 0 deletions packages/iptables/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# newer versions go on top
- version: "1.16.2"
changes:
- description: Use triple-brace Mustache templating when referencing variables in ingest pipelines.
type: bugfix
link: https://github.com/elastic/integrations/pull/11315
- version: "1.16.1"
changes:
- description: Invoke community_id processor only for supported protocols
Expand Down
Loading

0 comments on commit 2621bb0

Please sign in to comment.