Skip to content

Commit 0c68f20

Browse files
[cef] Generate processor tags and normalize error handler (#15526)
- Generate tags for processors missing tags - Normalize the pipeline error handler
1 parent b397ef0 commit 0c68f20

File tree

5 files changed

+67
-8
lines changed

5 files changed

+67
-8
lines changed

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

packages/cef/data_stream/log/elasticsearch/ingest_pipeline/cp-pipeline.yml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,26 +276,32 @@ processors:
276276
ctx["_tmp_copy"] = actions;
277277
278278
- foreach:
279+
tag: foreach__tmp_copy_ac4d5b1c
279280
field: _tmp_copy
280281
processor:
281282
set:
282283
field: '{{{_ingest._value.to}}}'
283284
value: '{{{_ingest._value.value}}}'
284285
- remove:
286+
tag: remove__tmp_copy_02a3c909
285287
field: _tmp_copy
286288
- set:
289+
tag: set_email_to_address_a2fb0fab
287290
if: ctx?.destination?.user?.email != null
288291
field: email.to.address
289292
value: ['{{{destination.user.email}}}']
290293
- set:
294+
tag: set_email_from_address_865dddfa
291295
if: ctx?.source?.user?.email != null
292296
field: email.from.address
293297
value: ['{{{source.user.email}}}']
294298
- set:
299+
tag: set_email_subject_d55a1a90
295300
if: ctx?.checkpoint?.email_subject != null
296301
field: email.subject
297302
copy_from: checkpoint.email_subject
298303
- set:
304+
tag: set_email_message_id_70b21e23
299305
if: ctx?.checkpoint?.email_session_id != null
300306
field: email.message_id
301307
copy_from: checkpoint.email_session_id
@@ -306,6 +312,7 @@ processors:
306312
type: float
307313
on_failure:
308314
- remove:
315+
tag: remove_event_risk_score_6ee4e8c9
309316
field: event.risk_score
310317
- convert:
311318
field: event.severity
@@ -314,6 +321,7 @@ processors:
314321
type: long
315322
on_failure:
316323
- remove:
324+
tag: remove_event_severity_8251ac98
317325
field: event.severity
318326
# event.duration is a string and contains seconds. Convert to long nanos.
319327
- script:
@@ -327,41 +335,50 @@ processors:
327335
tag: calculate duration
328336
on_failure:
329337
- remove:
338+
tag: remove_event_duration_8107f601
330339
field: event.duration
331340
ignore_missing: true
332341
# checkpoint.file_hash can be either MD5, SHA1 or SHA256.
333342
- rename:
343+
tag: rename_checkpoint_file_hash_to_file_hash_md5_00c600f1
334344
if: ctx.checkpoint?.file_hash != null && ctx.checkpoint.file_hash.length()==32
335345
field: checkpoint.file_hash
336346
target_field: file.hash.md5
337347
- rename:
348+
tag: rename_checkpoint_file_hash_to_file_hash_sha1_5b63a3eb
338349
if: ctx.checkpoint?.file_hash != null && ctx.checkpoint.file_hash.length()==40
339350
field: checkpoint.file_hash
340351
target_field: file.hash.sha1
341352
- rename:
353+
tag: rename_checkpoint_file_hash_to_file_hash_sha256_9082ab2f
342354
if: ctx.checkpoint?.file_hash != null && ctx.checkpoint.file_hash.length()==64
343355
field: checkpoint.file_hash
344356
target_field: file.hash.sha256
345357
# Event kind is 'event' by default. 'alert' when a risk score and rule info
346358
# is present.
347359
- set:
360+
tag: set_event_kind_de80643c
348361
field: event.kind
349362
value: event
350363
- set:
364+
tag: set_event_kind_97cac9f4
351365
if: ctx.cef?.extensions?.cp_app_risk != null && ctx.rule != null
352366
field: event.kind
353367
value: alert
354368
# Set event.category to network/malware/intrusion_detection depending on which
355369
# fields have been populated.
356370
- append:
371+
tag: append_event_category_01d5fb4a
357372
if: ctx.source?.ip != null && ctx.destination?.ip != null
358373
field: event.category
359374
value: network
360375
- append:
376+
tag: append_event_category_3f3c21f2
361377
if: ctx.checkpoint?.protection_id != null || ctx.checkpoint?.spyware_name != null || ctx.checkpoint?.malware_family != null || ctx.checkpoint?.spyware_status != null
362378
field: event.category
363379
value: malware
364380
- append:
381+
tag: append_event_category_762d9429
365382
if: ctx.event?.category != null && !(ctx.event.action.contains("malware")) && (ctx.checkpoint?.protection_type != null || ctx.cef.extensions?.flexString2Label == "Attack Information")
366383
field: event.category
367384
value: intrusion_detection
@@ -378,8 +395,11 @@ processors:
378395
on_failure:
379396
- append:
380397
field: error.message
381-
value: |-
382-
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 }}}"
398+
value: >-
399+
Processor '{{{ _ingest.on_failure_processor_type }}}'
400+
{{#_ingest.on_failure_processor_tag}}with tag '{{{ _ingest.on_failure_processor_tag }}}'
401+
{{/_ingest.on_failure_processor_tag}}in pipeline '{{{ _ingest.pipeline }}}'
402+
failed with message '{{{ _ingest.on_failure_message }}}'
383403
- set:
384404
field: event.kind
385405
value: pipeline_error

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

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
description: Pipeline for CEF logs. CEF decoding happens in the Agent. This performs additional enrichment and vendor specific transformations.
33
processors:
44
- set:
5+
tag: set_ecs_version_f5923549
56
field: ecs.version
67
value: 8.17.0
78
- convert:
@@ -22,6 +23,7 @@ processors:
2223
target_field: destination.geo
2324
# IP Autonomous System (AS) Lookup
2425
- geoip:
26+
tag: geoip_source_ip_to_source_as_28d69883
2527
field: source.ip
2628
database_file: GeoLite2-ASN.mmdb
2729
ignore_missing: true
@@ -30,6 +32,7 @@ processors:
3032
- organization_name
3133
target_field: source.as
3234
- geoip:
35+
tag: geoip_destination_ip_to_destination_as_8a007787
3336
field: destination.ip
3437
database_file: GeoLite2-ASN.mmdb
3538
ignore_missing: true
@@ -38,61 +41,74 @@ processors:
3841
- organization_name
3942
target_field: destination.as
4043
- rename:
44+
tag: rename_source_as_asn_to_source_as_number_a917047d
4145
field: source.as.asn
4246
ignore_missing: true
4347
target_field: source.as.number
4448
- rename:
49+
tag: rename_source_as_organization_name_to_source_as_organization_name_f1362d0b
4550
field: source.as.organization_name
4651
ignore_missing: true
4752
target_field: source.as.organization.name
4853
- rename:
54+
tag: rename_destination_as_asn_to_destination_as_number_3b459fcd
4955
field: destination.as.asn
5056
ignore_missing: true
5157
target_field: destination.as.number
5258
- rename:
59+
tag: rename_destination_as_organization_name_to_destination_as_organization_name_814bd459
5360
field: destination.as.organization_name
5461
ignore_missing: true
5562
target_field: destination.as.organization.name
5663
- append:
64+
tag: append_related_hash_592251e0
5765
if: ctx?.cef?.extensions?.fileHash != null && ctx?.cef?.extensions?.fileHash != ''
5866
field: related.hash
5967
allow_duplicates: false
6068
value: '{{{cef.extensions.fileHash}}}'
6169
- append:
70+
tag: append_related_hash_be4900bb
6271
if: ctx?.cef?.extensions?.oldFileHash != null && ctx?.cef?.extensions?.oldFileHash != ''
6372
field: related.hash
6473
allow_duplicates: false
6574
value: '{{{cef.extensions.oldFileHash}}}'
6675
- append:
76+
tag: append_related_ip_73d5506a
6777
if: ctx?.destination?.ip != null && ctx?.destination?.ip != ''
6878
field: related.ip
6979
allow_duplicates: false
7080
value: '{{{destination.ip}}}'
7181
- append:
82+
tag: append_related_ip_3da81053
7283
if: ctx?.destination?.nat?.ip != null && ctx?.destination?.nat?.ip != ''
7384
field: related.ip
7485
allow_duplicates: false
7586
value: '{{{destination.nat.ip}}}'
7687
- append:
88+
tag: append_related_ip_74a1d0ad
7789
if: ctx?.source?.ip != null && ctx?.source?.ip != ''
7890
field: related.ip
7991
allow_duplicates: false
8092
value: '{{{source.ip}}}'
8193
- append:
94+
tag: append_related_ip_78428a7e
8295
if: ctx?.source?.nat?.ip != null && ctx?.source?.nat?.ip != ''
8396
field: related.ip
8497
allow_duplicates: false
8598
value: '{{{source.nat.ip}}}'
8699
- append:
100+
tag: append_related_user_75c0abfc
87101
if: ctx?.destination?.user?.name != null
88102
field: related.user
89103
value: '{{{destination.user.name}}}'
90104
- append:
105+
tag: append_related_user_afcddc50
91106
if: ctx?.source?.user?.name != null && ctx?.source?.user?.name != ''
92107
field: related.user
93108
allow_duplicates: false
94109
value: '{{{source.user.name}}}'
95110
- append:
111+
tag: append_related_hosts_c0e4bbd6
96112
if: ctx?.observer?.hostname != null && ctx?.observer?.hostname != ''
97113
field: related.hosts
98114
allow_duplicates: false
@@ -121,11 +137,13 @@ processors:
121137
ignore_missing: true
122138
pattern: '[:.]'
123139
replacement: '-'
124-
tag: gsub mac
140+
tag: gsub_source_mac_1b14f2a4
125141
- uppercase:
142+
tag: uppercase_destination_mac_04de3657
126143
field: destination.mac
127144
ignore_missing: true
128145
- uppercase:
146+
tag: uppercase_source_mac_5b4e7be2
129147
field: source.mac
130148
ignore_missing: true
131149
#
@@ -146,17 +164,20 @@ processors:
146164
- '^%{ECS_SYSLOG_PRI}%{NONNEGINT} %{SYSLOG_TIMESTAMP} ' # RFC5224
147165
tag: timestamp extract grok
148166
- date:
167+
tag: date__tmp_timestamp8601_c38c0806
149168
if: ctx?._tmp?.timestamp8601 != null
150169
field: _tmp.timestamp8601
151170
formats:
152171
- ISO8601
153172
- date:
173+
tag: date__tmp_timestamp_771f472e
154174
if: ctx?._tmp?.timestamp != null
155175
field: _tmp.timestamp
156176
formats:
157177
- MMM d HH:mm:ss
158178
- MMM dd HH:mm:ss
159179
- remove:
180+
tag: remove_event_original_9f895a30
160181
if: ctx?.tags == null || !(ctx.tags.contains('preserve_original_event'))
161182
field: event.original
162183
ignore_failure: true
@@ -176,15 +197,18 @@ processors:
176197
value: '{{{_tmp.observer}}}'
177198
# Set ECS event outcome from ArcSight outcomes
178199
- set:
200+
tag: set_event_outcome_da09bb71
179201
if: ctx.cef?.extensions?.categoryOutcome == "/Success"
180202
field: event.outcome
181203
value: success
182204
- set:
205+
tag: set_event_outcome_cb9ede45
183206
if: ctx.cef?.extensions?.categoryOutcome == "/Failure"
184207
field: event.outcome
185208
value: failure
186209
# Cleanup
187210
- remove:
211+
tag: remove_8c701636
188212
field:
189213
- cef.extensions._cefVer
190214
- _tmp
@@ -196,8 +220,11 @@ on_failure:
196220
ignore_missing: true
197221
- append:
198222
field: error.message
199-
value: |-
200-
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 }}}"
223+
value: >-
224+
Processor '{{{ _ingest.on_failure_processor_type }}}'
225+
{{#_ingest.on_failure_processor_tag}}with tag '{{{ _ingest.on_failure_processor_tag }}}'
226+
{{/_ingest.on_failure_processor_tag}}in pipeline '{{{ _ingest.pipeline }}}'
227+
failed with message '{{{ _ingest.on_failure_message }}}'
201228
- set:
202229
field: event.kind
203230
value: pipeline_error

packages/cef/data_stream/log/elasticsearch/ingest_pipeline/fp-pipeline.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,36 @@ description: Pipeline for Forcepoint CEF
33
processors:
44
# cs1 is ruleID
55
- set:
6+
tag: set_rule_id_7a577460
67
field: rule.id
78
ignore_empty_value: true
89
value: '{{{cef.extensions.deviceCustomString1}}}'
910
# cs2 is natRuleID
1011
- set:
12+
tag: set_rule_id_c76c7491
1113
field: rule.id
1214
ignore_empty_value: true
1315
value: '{{{cef.extensions.deviceCustomString2}}}'
1416
# cs3 is VulnerabilityReference
1517
- set:
18+
tag: set_vulnerability_reference_0b703e9a
1619
field: vulnerability.reference
1720
ignore_empty_value: true
1821
value: '{{{cef.extensions.deviceCustomString3}}}'
1922
# cs4 is virusID
2023
- set:
24+
tag: set_cef_forcepoint_virus_id_ce0473c6
2125
field: cef.forcepoint.virus_id
2226
ignore_empty_value: true
2327
value: '{{{cef.extensions.deviceCustomString4}}}'
2428
on_failure:
2529
- append:
2630
field: error.message
27-
value: |-
28-
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 }}}"
31+
value: >-
32+
Processor '{{{ _ingest.on_failure_processor_type }}}'
33+
{{#_ingest.on_failure_processor_tag}}with tag '{{{ _ingest.on_failure_processor_tag }}}'
34+
{{/_ingest.on_failure_processor_tag}}in pipeline '{{{ _ingest.pipeline }}}'
35+
failed with message '{{{ _ingest.on_failure_message }}}'
2936
- set:
3037
field: event.kind
3138
value: pipeline_error

packages/cef/manifest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: cef
22
title: Common Event Format (CEF)
3-
version: "2.21.2"
3+
version: "2.21.3"
44
description: Collect logs from CEF Logs with Elastic Agent.
55
categories:
66
- security

0 commit comments

Comments
 (0)