Skip to content

Commit 87d8dbd

Browse files
[cisco_secure_email_gateway] Generate processor tags and normalize error handler (#15534)
- Generate tags for processors missing tags - Normalize the pipeline error handler
1 parent 53ab260 commit 87d8dbd

15 files changed

+279
-28
lines changed

packages/cisco_secure_email_gateway/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: "1.27.2"
3+
changes:
4+
- description: Generate processor tags and normalize error handler.
5+
type: enhancement
6+
link: https://github.com/elastic/integrations/pull/15534
27
- version: "1.27.1"
38
changes:
49
- description: Changed owners.

packages/cisco_secure_email_gateway/data_stream/log/elasticsearch/ingest_pipeline/default.yml

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,54 +2,66 @@
22
description: Pipeline for Cisco Secure Email Gateway logs.
33
processors:
44
- set:
5+
tag: set_ecs_version_f5923549
56
field: ecs.version
67
value: '8.17.0'
78
- set:
9+
tag: set__tmp_filepath_bc60fe22
810
field: _tmp.filepath
911
value: '{{{log.file.path}}}'
1012
if: ctx.log?.file?.path != null
1113
- grok:
14+
tag: grok__tmp_filepath_3fc3092e
1215
field: _tmp.filepath
1316
if: ctx.log?.file?.path != null
1417
ignore_failure: true
1518
patterns:
1619
- '^%{DATA}[\\/]%{WORD:cisco_secure_email_gateway.log.category.name}(?:\.%{HOSTNAME:cisco_secure_email_gateway.log.host})?\.@%{GREEDYDATA}\.s$'
1720
- rename:
21+
tag: rename_message_to_event_original_56a77271
1822
field: message
1923
target_field: event.original
2024
ignore_missing: true
2125
if: ctx.event?.original == null
2226
- grok:
27+
tag: grok_event_original_0ef2f0a7
2328
field: event.original
2429
patterns:
2530
- '^(?:<%{NUMBER:log.syslog.priority:long}>)?%{SYSLOGTIMESTAMP:_tmp.timestamp} (?:%{HOSTNAME:cisco_secure_email_gateway.log.host} )?%{NOTSPACE:cisco_secure_email_gateway.log.category.name}: %{WORD:log.level}: %{GREEDYDATA:cisco_secure_email_gateway.log.message}$'
2631
- '^(?:<%{NUMBER:log.syslog.priority:long}>)?%{SYSLOGTIMESTAMP:_tmp.timestamp} (?:%{HOSTNAME:cisco_secure_email_gateway.log.host} )?%{NOTSPACE:cisco_secure_email_gateway.log.category.name}: %{GREEDYDATA:cisco_secure_email_gateway.log.message}$'
2732
- '^%{DATA:_tmp.timestamp} %{WORD:log.level}: %{GREEDYDATA:cisco_secure_email_gateway.log.message}$'
2833
- '^%{GREEDYDATA:cisco_secure_email_gateway.log.message}$'
2934
- trim:
35+
tag: trim_cisco_secure_email_gateway_log_message_610465ba
3036
field: cisco_secure_email_gateway.log.message
3137
ignore_failure: true
3238
- lowercase:
39+
tag: lowercase_log_level_e59b6b49
3340
field: log.level
3441
ignore_failure: true
3542
# Time zone can come from two sources, choose in order: config, locale, default to UTC.
3643
- set:
44+
tag: set__tmp_tz_5079f7eb
3745
field: _tmp.tz
3846
copy_from: _conf.tz_offset
3947
if: ctx._conf?.tz_offset != null && ctx._conf?.tz_offset != 'local'
4048
- set:
49+
tag: set__tmp_tz_43d96fc2
4150
field: _tmp.tz
4251
copy_from: event.timezone
4352
override: false
4453
if: ctx.event?.timezone != null
4554
- set:
55+
tag: set__tmp_tz_b8df3735
4656
field: _tmp.tz
4757
value: UTC
4858
override: false
4959
- set:
60+
tag: set_event_timezone_ba6cb968
5061
field: event.timezone
5162
copy_from: _tmp.tz
5263
- date:
64+
tag: date__tmp_timestamp_11c130e5
5365
field: _tmp.timestamp
5466
timezone: "{{{ event.timezone }}}"
5567
if: ctx._tmp?.timestamp != null
@@ -63,9 +75,11 @@ processors:
6375
on_failure:
6476
# Try to re-parse as UTC to catch when TZ is invalid or unknown.
6577
- remove:
78+
tag: remove_event_timezone_aeeaa3d5
6679
field: event.timezone
6780
ignore_missing: true
6881
- date:
82+
tag: date__tmp_timestamp_c043b8fc
6983
field: _tmp.timestamp
7084
if: ctx._tmp?.timestamp != null
7185
formats:
@@ -76,59 +90,76 @@ processors:
7690
- MMM dd HH:mm:ss
7791
- MMM d HH:mm:ss
7892
- pipeline:
93+
tag: pipeline_e1b0fc56
7994
name: '{{ IngestPipeline "pipeline_authentication" }}'
8095
if: ctx.cisco_secure_email_gateway?.log?.category?.name == 'authentication'
8196
- pipeline:
97+
tag: pipeline_ad806cb2
8298
name: '{{ IngestPipeline "pipeline_gui_logs" }}'
8399
if: ctx.cisco_secure_email_gateway?.log?.category?.name == 'gui_logs'
84100
- pipeline:
101+
tag: pipeline_9b0b8b89
85102
name: '{{ IngestPipeline "pipeline_anti_spam" }}'
86103
if: ctx.cisco_secure_email_gateway?.log?.category?.name == 'antispam'
87104
- pipeline:
105+
tag: pipeline_928f3e7a
88106
name: '{{ IngestPipeline "pipeline_error_logs" }}'
89107
if: ctx.cisco_secure_email_gateway?.log?.category?.name == 'error_logs'
90108
- pipeline:
109+
tag: pipeline_5281e984
91110
name: '{{ IngestPipeline "pipeline_text_mail_logs" }}'
92111
if: ctx.cisco_secure_email_gateway?.log?.category?.name == 'mail_logs'
93112
- pipeline:
113+
tag: pipeline_d6dcedc4
94114
name: '{{ IngestPipeline "pipeline_content_scanner" }}'
95115
if: ctx.cisco_secure_email_gateway?.log?.category?.name == 'content_scanner'
96116
- pipeline:
117+
tag: pipeline_580b3b8e
97118
name: '{{ IngestPipeline "pipeline_system" }}'
98119
if: ctx.cisco_secure_email_gateway?.log?.category?.name == 'system'
99120
- pipeline:
121+
tag: pipeline_1f40bd85
100122
name: '{{ IngestPipeline "pipeline_bounce" }}'
101123
if: ctx.cisco_secure_email_gateway?.log?.category?.name == 'bounces'
102124
- pipeline:
125+
tag: pipeline_181277ba
103126
name: '{{ IngestPipeline "pipeline_status" }}'
104127
if: ctx.cisco_secure_email_gateway?.log?.category?.name == 'status'
105128
- pipeline:
129+
tag: pipeline_34c6b064
106130
name: '{{ IngestPipeline "pipeline_amp" }}'
107131
if: ctx.cisco_secure_email_gateway?.log?.category?.name == 'amp'
108132
- pipeline:
133+
tag: pipeline_7d301c2a
109134
name: '{{ IngestPipeline "pipeline_consolidated_event" }}'
110135
if: '["consolidated_event", "SplunkGIS"].contains(ctx.cisco_secure_email_gateway?.log?.category?.name)'
111136
- pipeline:
137+
tag: pipeline_80b3dc7a
112138
name: '{{ IngestPipeline "pipeline_antivirus" }}'
113139
if: ctx.cisco_secure_email_gateway?.log?.category?.name == 'antivirus'
114140
- set:
141+
tag: set_email_from_address_fff7c0a5
115142
field: email.from.address
116143
value: ['{{{email.from.address}}}']
117144
if: ctx.email?.from?.address instanceof String
118145
- set:
146+
tag: set_email_to_address_52631338
119147
field: email.to.address
120148
value: ['{{{email.to.address}}}']
121149
if: ctx.email?.to?.address instanceof String
122150
- set:
151+
tag: set_event_category_d7f508d2
123152
field: event.category
124153
value: vulnerability
125154
if: ctx.cisco_secure_email_gateway?.log?.category?.name == 'antivirus'
126155
- remove:
156+
tag: remove_3f586893
127157
field:
128158
- _tmp
129159
- _conf
130160
ignore_missing: true
131161
- script:
162+
tag: script_b274a7df
132163
lang: painless
133164
source: |
134165
boolean dropEmptyFields(Object object) {
@@ -150,5 +181,8 @@ on_failure:
150181
value: pipeline_error
151182
- append:
152183
field: error.message
153-
value: |-
154-
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 }}}"
184+
value: >-
185+
Processor '{{{ _ingest.on_failure_processor_type }}}'
186+
{{#_ingest.on_failure_processor_tag}}with tag '{{{ _ingest.on_failure_processor_tag }}}'
187+
{{/_ingest.on_failure_processor_tag}}in pipeline '{{{ _ingest.pipeline }}}'
188+
failed with message '{{{ _ingest.on_failure_message }}}'

packages/cisco_secure_email_gateway/data_stream/log/elasticsearch/ingest_pipeline/pipeline_amp.yml

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
---
22
processors:
33
- set:
4+
tag: set_event_kind_de80643c
45
field: event.kind
56
value: event
67
- grok:
8+
tag: grok_cisco_secure_email_gateway_log_message_4f15232d
79
field: cisco_secure_email_gateway.log.message
810
patterns:
911
- '^File reputation query initiating. %{GREEDYDATA:_tmp.new_message}$'
@@ -15,127 +17,156 @@ processors:
1517
- '^Retrospective verdict received. %{GREEDYDATA:_tmp.new_message}$'
1618
- '^%{GREEDYDATA:cisco_secure_email_gateway.log.message}$'
1719
- kv:
20+
tag: kv__tmp_new_message_0bb63133
1821
field: _tmp.new_message
1922
if: ctx._tmp.new_message != null
2023
field_split: ",\\s*(?=[^',]*[=:][^',]*)"
2124
value_split: '\s*=\s*|:\s*'
2225
- grok:
26+
tag: grok__tmp_cisco_secure_email_gateway_log_remaining_details_7273cf72
2327
field: _tmp.cisco_secure_email_gateway.log.remaining_details
2428
if: ctx._tmp?.cisco_secure_email_gateway?.log?.remaining_details != null
2529
patterns:
2630
- '^File SHA256\[%{GREEDYDATA:email.attachments.file.hash.sha256}\] file mime\[%{GREEDYDATA:email.attachments.file.mime_type}\], upload priority\[%{GREEDYDATA:cisco_secure_email_gateway.log.upload.priority}\] not uploaded, re-tries\[%{GREEDYDATA:cisco_secure_email_gateway.log.retries:long}\], backoff\[%{GREEDYDATA:cisco_secure_email_gateway.log.backoff:long}\] %{GREEDYDATA:cisco_secure_email_gateway.log.details}$'
2731
- rename:
32+
tag: rename_Timestamp_to__tmp_submit_timestamp_1031a728
2833
field: Timestamp
2934
target_field: _tmp.submit.timestamp
3035
ignore_missing: true
3136
- date:
37+
tag: date__tmp_submit_timestamp_to_cisco_secure_email_gateway_log_submit_timestamp_dd83046a
3238
field: _tmp.submit.timestamp
3339
target_field: cisco_secure_email_gateway.log.submit.timestamp
3440
if: ctx._tmp?.submit?.timestamp != null && ctx.cisco_secure_email_gateway?.log?._tmp?.submit?.timestamp != '0'
3541
formats:
3642
- UNIX
3743
on_failure:
3844
- append:
45+
tag: append_error_message_c26fa851
3946
field: error.message
4047
value: '{{{_ingest.on_failure_message}}}'
4148
- date:
49+
tag: date__tmp_update_timestamp_to_cisco_secure_email_gateway_log_update_timestamp_5d6d9d79
4250
field: _tmp.update.timestamp
4351
target_field: cisco_secure_email_gateway.log.update.timestamp
4452
if: ctx._tmp.update?.timestamp != null && ctx.cisco_secure_email_gateway?.log?._tmp?.update?.timestamp != '0'
4553
formats:
4654
- UNIX
4755
on_failure:
4856
- append:
57+
tag: append_error_message_5fc2eb40
4958
field: error.message
5059
value: '{{{_ingest.on_failure_message}}}'
5160
- rename:
61+
tag: rename_File_Name_to_email_attachments_file_name_b9cd094c
5262
field: File Name
5363
target_field: email.attachments.file.name
5464
ignore_missing: true
5565
- rename:
66+
tag: rename_MID_to_email_message_id_a1506dc1
5667
field: MID
5768
target_field: email.message_id
5869
ignore_missing: true
5970
- gsub:
71+
tag: gsub_File_Size_07980b8f
6072
field: 'File Size'
6173
pattern: '\ bytes'
6274
replacement: ''
6375
ignore_failure: true
6476
- convert:
77+
tag: convert_File_Size_to_email_attachments_file_size_1e170071
6578
field: 'File Size'
6679
target_field: email.attachments.file.size
6780
type: long
6881
ignore_missing: true
6982
on_failure:
7083
- remove:
84+
tag: remove_File_Size_d7be2622
7185
field: 'File Size'
7286
- append:
87+
tag: append_error_message_c78edce4
7388
field: error.message
7489
value: '{{{_ingest.on_failure_message}}}'
7590
- rename:
91+
tag: rename_File_Type_to_email_content_type_16c2f40c
7692
field: 'File Type'
7793
target_field: email.content_type
7894
ignore_missing: true
7995
- rename:
96+
tag: rename_FileName_to_email_attachments_file_name_0ccba13e
8097
field: FileName
8198
target_field: email.attachments.file.name
8299
ignore_missing: true
83100
- rename:
101+
tag: rename_Malware_to_cisco_secure_email_gateway_log_malware_c3847855
84102
field: Malware
85103
target_field: cisco_secure_email_gateway.log.malware
86104
ignore_missing: true
87105
- rename:
106+
tag: rename_Disposition_to_cisco_secure_email_gateway_log_disposition_855f2689
88107
field: Disposition
89108
target_field: cisco_secure_email_gateway.log.disposition
90109
ignore_missing: true
91110
- convert:
111+
tag: convert_Analysis_Score_cccaa177
92112
field: 'Analysis Score'
93113
type: long
94114
ignore_missing: true
95115
- rename:
116+
tag: rename_Analysis_Score_to_cisco_secure_email_gateway_log_score_2aaa7d11
96117
field: 'Analysis Score'
97118
target_field: cisco_secure_email_gateway.log.score
98119
ignore_missing: true
99120
- rename:
121+
tag: rename_sha256_to_email_attachments_file_hash_sha256_d9ce7f1c
100122
field: sha256
101123
target_field: email.attachments.file.hash.sha256
102124
ignore_missing: true
103125
- rename:
126+
tag: rename_upload_action_to_cisco_secure_email_gateway_log_upload_action_08c9aeac
104127
field: upload_action
105128
target_field: cisco_secure_email_gateway.log.upload.action
106129
ignore_missing: true
107130
- rename:
131+
tag: rename_Reputation_Score_to_cisco_secure_email_gateway_log_reputation_score_f7e1261a
108132
field: 'Reputation Score'
109133
target_field: cisco_secure_email_gateway.log.reputation_score
110134
ignore_missing: true
111135
- rename:
136+
tag: rename_SHA256_to_email_attachments_file_hash_sha256_a100e0fc
112137
field: SHA256
113138
target_field: email.attachments.file.hash.sha256
114139
ignore_missing: true
115140
- rename:
141+
tag: rename_Spyname_to_cisco_secure_email_gateway_log_spy_name_53fe4fbe
116142
field: Spyname
117143
target_field: cisco_secure_email_gateway.log.spy_name
118144
ignore_missing: true
119145
- rename:
146+
tag: rename_Verdict_to_cisco_secure_email_gateway_log_verdict_094b3001
120147
field: Verdict
121148
target_field: cisco_secure_email_gateway.log.verdict
122149
ignore_missing: true
123150
- rename:
151+
tag: rename_verdict_source_to_cisco_secure_email_gateway_log_verdict_source_869c1997
124152
field: verdict_source
125153
target_field: cisco_secure_email_gateway.log.verdict_source
126154
ignore_missing: true
127155
- gsub:
156+
tag: gsub_email_attachments_file_name_e3527757
128157
field: email.attachments.file.name
129158
pattern: \'
130159
replacement: ''
131160
ignore_failure: true
132161
- append:
162+
tag: append_related_hash_227eb64c
133163
field: related.hash
134164
value: '{{{email.attachments.file.hash.sha256}}}'
135165
if: ctx.email?.attachments?.file?.hash?.sha256 != null
136166
allow_duplicates: false
137167
ignore_failure: true
138168
- remove:
169+
tag: remove_fe577437
139170
field:
140171
- _tmp
141172
- 'File Size'
@@ -146,4 +177,8 @@ on_failure:
146177
value: pipeline_error
147178
- append:
148179
field: error.message
149-
value: '{{{ _ingest.on_failure_message }}}'
180+
value: >-
181+
Processor '{{{ _ingest.on_failure_processor_type }}}'
182+
{{#_ingest.on_failure_processor_tag}}with tag '{{{ _ingest.on_failure_processor_tag }}}'
183+
{{/_ingest.on_failure_processor_tag}}in pipeline '{{{ _ingest.pipeline }}}'
184+
failed with message '{{{ _ingest.on_failure_message }}}'

packages/cisco_secure_email_gateway/data_stream/log/elasticsearch/ingest_pipeline/pipeline_anti_spam.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
---
22
processors:
33
- set:
4+
tag: set_event_kind_de80643c
45
field: event.kind
56
value: event
67
- grok:
8+
tag: grok_cisco_secure_email_gateway_log_message_2188ef85
79
field: cisco_secure_email_gateway.log.message
810
patterns:
911
- '^case %{GREEDYDATA:cisco_secure_email_gateway.log.object_category} \(%{NUMBER:cisco_secure_email_gateway.log.case_id}\) : case-daemon: all %{DATA:cisco_secure_email_gateway.log.object} killed, %{GREEDYDATA:cisco_secure_email_gateway.log.result}$'
@@ -16,4 +18,8 @@ on_failure:
1618
value: pipeline_error
1719
- append:
1820
field: error.message
19-
value: '{{{ _ingest.on_failure_message }}}'
21+
value: >-
22+
Processor '{{{ _ingest.on_failure_processor_type }}}'
23+
{{#_ingest.on_failure_processor_tag}}with tag '{{{ _ingest.on_failure_processor_tag }}}'
24+
{{/_ingest.on_failure_processor_tag}}in pipeline '{{{ _ingest.pipeline }}}'
25+
failed with message '{{{ _ingest.on_failure_message }}}'

0 commit comments

Comments
 (0)