Skip to content

Commit 1b11c08

Browse files
[cef] Generate processor tags and normalize error handler
- Generate tags for processors missing tags - Normalize the pipeline error handler
1 parent dea9fc2 commit 1b11c08

File tree

3 files changed

+54
-6
lines changed

3 files changed

+54
-6
lines changed

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

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,24 +281,30 @@ processors:
281281
set:
282282
field: '{{{_ingest._value.to}}}'
283283
value: '{{{_ingest._value.value}}}'
284+
tag: foreach_ac4d5b1c
284285
- remove:
285286
field: _tmp_copy
287+
tag: remove_02a3c909
286288
- set:
287289
if: ctx?.destination?.user?.email != null
288290
field: email.to.address
289291
value: ['{{{destination.user.email}}}']
292+
tag: set_a2fb0fab
290293
- set:
291294
if: ctx?.source?.user?.email != null
292295
field: email.from.address
293296
value: ['{{{source.user.email}}}']
297+
tag: set_865dddfa
294298
- set:
295299
if: ctx?.checkpoint?.email_subject != null
296300
field: email.subject
297301
copy_from: checkpoint.email_subject
302+
tag: set_d55a1a90
298303
- set:
299304
if: ctx?.checkpoint?.email_session_id != null
300305
field: email.message_id
301306
copy_from: checkpoint.email_session_id
307+
tag: set_70b21e23
302308
- convert:
303309
field: event.risk_score
304310
ignore_missing: true
@@ -334,37 +340,45 @@ processors:
334340
if: ctx.checkpoint?.file_hash != null && ctx.checkpoint.file_hash.length()==32
335341
field: checkpoint.file_hash
336342
target_field: file.hash.md5
343+
tag: rename_00c600f1
337344
- rename:
338345
if: ctx.checkpoint?.file_hash != null && ctx.checkpoint.file_hash.length()==40
339346
field: checkpoint.file_hash
340347
target_field: file.hash.sha1
348+
tag: rename_5b63a3eb
341349
- rename:
342350
if: ctx.checkpoint?.file_hash != null && ctx.checkpoint.file_hash.length()==64
343351
field: checkpoint.file_hash
344352
target_field: file.hash.sha256
353+
tag: rename_9082ab2f
345354
# Event kind is 'event' by default. 'alert' when a risk score and rule info
346355
# is present.
347356
- set:
348357
field: event.kind
349358
value: event
359+
tag: set_de80643c
350360
- set:
351361
if: ctx.cef?.extensions?.cp_app_risk != null && ctx.rule != null
352362
field: event.kind
353363
value: alert
364+
tag: set_97cac9f4
354365
# Set event.category to network/malware/intrusion_detection depending on which
355366
# fields have been populated.
356367
- append:
357368
if: ctx.source?.ip != null && ctx.destination?.ip != null
358369
field: event.category
359370
value: network
371+
tag: append_01d5fb4a
360372
- append:
361373
if: ctx.checkpoint?.protection_id != null || ctx.checkpoint?.spyware_name != null || ctx.checkpoint?.malware_family != null || ctx.checkpoint?.spyware_status != null
362374
field: event.category
363375
value: malware
376+
tag: append_3f3c21f2
364377
- append:
365378
if: ctx.event?.category != null && !(ctx.event.action.contains("malware")) && (ctx.checkpoint?.protection_type != null || ctx.cef.extensions?.flexString2Label == "Attack Information")
366379
field: event.category
367380
value: intrusion_detection
381+
tag: append_762d9429
368382
- convert:
369383
field: checkpoint.event_count
370384
ignore_missing: true
@@ -378,8 +392,10 @@ processors:
378392
on_failure:
379393
- append:
380394
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 }}}"
395+
value: >-
396+
Processor '{{{ _ingest.on_failure_processor_type }}}'
397+
{{#_ingest.on_failure_processor_tag}}with tag '{{{ _ingest.on_failure_processor_tag }}}'
398+
{{/_ingest.on_failure_processor_tag}}failed with message '{{{ _ingest.on_failure_message }}}'
383399
- set:
384400
field: event.kind
385401
value: pipeline_error

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

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ processors:
44
- set:
55
field: ecs.version
66
value: 8.17.0
7+
tag: set_f5923549
78
- convert:
89
field: event.id
910
ignore_missing: true
@@ -29,6 +30,7 @@ processors:
2930
- asn
3031
- organization_name
3132
target_field: source.as
33+
tag: geoip_28d69883
3234
- geoip:
3335
field: destination.ip
3436
database_file: GeoLite2-ASN.mmdb
@@ -37,66 +39,80 @@ processors:
3739
- asn
3840
- organization_name
3941
target_field: destination.as
42+
tag: geoip_8a007787
4043
- rename:
4144
field: source.as.asn
4245
ignore_missing: true
4346
target_field: source.as.number
47+
tag: rename_a917047d
4448
- rename:
4549
field: source.as.organization_name
4650
ignore_missing: true
4751
target_field: source.as.organization.name
52+
tag: rename_f1362d0b
4853
- rename:
4954
field: destination.as.asn
5055
ignore_missing: true
5156
target_field: destination.as.number
57+
tag: rename_3b459fcd
5258
- rename:
5359
field: destination.as.organization_name
5460
ignore_missing: true
5561
target_field: destination.as.organization.name
62+
tag: rename_814bd459
5663
- append:
5764
if: ctx?.cef?.extensions?.fileHash != null && ctx?.cef?.extensions?.fileHash != ''
5865
field: related.hash
5966
allow_duplicates: false
6067
value: '{{{cef.extensions.fileHash}}}'
68+
tag: append_592251e0
6169
- append:
6270
if: ctx?.cef?.extensions?.oldFileHash != null && ctx?.cef?.extensions?.oldFileHash != ''
6371
field: related.hash
6472
allow_duplicates: false
6573
value: '{{{cef.extensions.oldFileHash}}}'
74+
tag: append_be4900bb
6675
- append:
6776
if: ctx?.destination?.ip != null && ctx?.destination?.ip != ''
6877
field: related.ip
6978
allow_duplicates: false
7079
value: '{{{destination.ip}}}'
80+
tag: append_73d5506a
7181
- append:
7282
if: ctx?.destination?.nat?.ip != null && ctx?.destination?.nat?.ip != ''
7383
field: related.ip
7484
allow_duplicates: false
7585
value: '{{{destination.nat.ip}}}'
86+
tag: append_3da81053
7687
- append:
7788
if: ctx?.source?.ip != null && ctx?.source?.ip != ''
7889
field: related.ip
7990
allow_duplicates: false
8091
value: '{{{source.ip}}}'
92+
tag: append_74a1d0ad
8193
- append:
8294
if: ctx?.source?.nat?.ip != null && ctx?.source?.nat?.ip != ''
8395
field: related.ip
8496
allow_duplicates: false
8597
value: '{{{source.nat.ip}}}'
98+
tag: append_78428a7e
8699
- append:
87100
if: ctx?.destination?.user?.name != null
88101
field: related.user
89102
value: '{{{destination.user.name}}}'
103+
tag: append_75c0abfc
90104
- append:
91105
if: ctx?.source?.user?.name != null && ctx?.source?.user?.name != ''
92106
field: related.user
93107
allow_duplicates: false
94108
value: '{{{source.user.name}}}'
109+
tag: append_afcddc50
95110
- append:
96111
if: ctx?.observer?.hostname != null && ctx?.observer?.hostname != ''
97112
field: related.hosts
98113
allow_duplicates: false
99114
value: '{{{observer.hostname}}}'
115+
tag: append_c0e4bbd6
100116
- pipeline:
101117
if: ctx.cef?.device?.vendor == 'FORCEPOINT'
102118
name: '{{ IngestPipeline "fp-pipeline" }}'
@@ -125,9 +141,11 @@ processors:
125141
- uppercase:
126142
field: destination.mac
127143
ignore_missing: true
144+
tag: uppercase_04de3657
128145
- uppercase:
129146
field: source.mac
130147
ignore_missing: true
148+
tag: uppercase_5b4e7be2
131149
#
132150
# Timestamp parsing.
133151
#
@@ -150,17 +168,20 @@ processors:
150168
field: _tmp.timestamp8601
151169
formats:
152170
- ISO8601
171+
tag: date_c38c0806
153172
- date:
154173
if: ctx?._tmp?.timestamp != null
155174
field: _tmp.timestamp
156175
formats:
157176
- MMM d HH:mm:ss
158177
- MMM dd HH:mm:ss
178+
tag: date_771f472e
159179
- remove:
160180
if: ctx?.tags == null || !(ctx.tags.contains('preserve_original_event'))
161181
field: event.original
162182
ignore_failure: true
163183
ignore_missing: true
184+
tag: remove_9f895a30
164185
# Converting the observer.ip to an array if its not, to provide correct ECS mapping with backwards compatibility.
165186
# Later this should be changed in the decode_cef processor as well.
166187
- rename:
@@ -179,25 +200,30 @@ processors:
179200
if: ctx.cef?.extensions?.categoryOutcome == "/Success"
180201
field: event.outcome
181202
value: success
203+
tag: set_da09bb71
182204
- set:
183205
if: ctx.cef?.extensions?.categoryOutcome == "/Failure"
184206
field: event.outcome
185207
value: failure
208+
tag: set_cb9ede45
186209
# Cleanup
187210
- remove:
188211
field:
189212
- cef.extensions._cefVer
190213
- _tmp
191214
ignore_missing: true
215+
tag: remove_8c701636
192216
on_failure:
193217
- remove:
194218
field:
195219
- _tmp
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}}failed with message '{{{ _ingest.on_failure_message }}}'
201227
- set:
202228
field: event.kind
203229
value: pipeline_error

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,32 @@ processors:
66
field: rule.id
77
ignore_empty_value: true
88
value: '{{{cef.extensions.deviceCustomString1}}}'
9+
tag: set_7a577460
910
# cs2 is natRuleID
1011
- set:
1112
field: rule.id
1213
ignore_empty_value: true
1314
value: '{{{cef.extensions.deviceCustomString2}}}'
15+
tag: set_c76c7491
1416
# cs3 is VulnerabilityReference
1517
- set:
1618
field: vulnerability.reference
1719
ignore_empty_value: true
1820
value: '{{{cef.extensions.deviceCustomString3}}}'
21+
tag: set_0b703e9a
1922
# cs4 is virusID
2023
- set:
2124
field: cef.forcepoint.virus_id
2225
ignore_empty_value: true
2326
value: '{{{cef.extensions.deviceCustomString4}}}'
27+
tag: set_ce0473c6
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}}failed with message '{{{ _ingest.on_failure_message }}}'
2935
- set:
3036
field: event.kind
3137
value: pipeline_error

0 commit comments

Comments
 (0)