Skip to content

Commit 5a0e1e4

Browse files
committed
This commit resolves most of the comments made to the PR
1 parent 413259a commit 5a0e1e4

10 files changed

Lines changed: 550 additions & 57 deletions

File tree

filebeat/docs/fields.asciidoc

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20774,16 +20774,6 @@ Module for parsing Cisco AMP logs.
2077420774
The timestamp in Epoch nanoseconds.
2077520775

2077620776

20777-
type: date
20778-
20779-
--
20780-
20781-
*`cisco.amp.date`*::
20782-
+
20783-
--
20784-
The timestamp in ISO8601 format.
20785-
20786-
2078720777
type: date
2078820778

2078920779
--
@@ -21244,7 +21234,7 @@ type: keyword
2124421234
When the threat hunt finalized or closed.
2124521235

2124621236

21247-
type: keyword
21237+
type: date
2124821238

2124921239
--
2125021240

@@ -21254,7 +21244,7 @@ type: keyword
2125421244
When the threat hunt was initiated.
2125521245

2125621246

21257-
type: keyword
21247+
type: date
2125821248

2125921249
--
2126021250

filebeat/docs/modules/cisco.asciidoc

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ This is a module for Cisco network device's logs and Cisco Umbrella. It includes
1414
filesets for receiving logs over syslog or read from a file:
1515

1616
- `asa` fileset: supports Cisco ASA firewall logs.
17-
- `amp` fileset: supports Cisco Umbrella logs.
17+
- `amp` fileset: supports Cisco AMP API logs.
1818
- `ftd` fileset: supports Cisco Firepower Threat Defense logs.
1919
- `ios` fileset: supports Cisco IOS router and switch logs.
2020
- `nexus` fileset: supports Cisco Nexus switch logs.
@@ -448,9 +448,9 @@ Maximum duration before AWS API request will be interrupted. Default to be 120 s
448448
[float]
449449
==== `amp` fileset settings
450450

451-
The Cisco AMP fileset focuses on collecting events from your Cisco AMP/Cisco Securi Endpoint API.
451+
The Cisco AMP fileset focuses on collecting events from your Cisco AMP/Cisco Secure Endpoint API.
452452

453-
To configure the Cisco AMP fileset you will need to retrieve your client_id and client_key from the AMP dashboard.
453+
To configure the Cisco AMP fileset you will need to retrieve your `client_id` and `api_key` from the AMP dashboard.
454454
For more information on how to retrieve these credentials, please reference the https://api-docs.amp.cisco.com/api_resources?api_host=api.amp.cisco.com&api_version=v1[Cisco AMP API documentation].
455455

456456
The URL configured for the API depends on which region your AMP is located, currently there is 3 choices:
@@ -488,12 +488,13 @@ It is also possible to select how often Filebeat will check the Cisco AMP API. A
488488
var.first_interval: 200h
489489
var.interval: 60m
490490
var.request_timeout: 120s
491+
var.limit: 100
491492
492493
----
493494

494495
*`var.input`*::
495496

496-
The input from which messages are read. Supports httpjson(default) and file.
497+
The input from which messages are read. Supports httpjson.
497498

498499
*`var.url`*::
499500

@@ -516,6 +517,10 @@ timeout value for each request sent by Filebeat.
516517

517518
How far back you would want to collect events the first time the Filebeat module starts up. Supports amount in hours.
518519

520+
*`var.limit`*::
521+
522+
This value controls how many events are returned by the Cisco AMP API per page.
523+
519524
:has-dashboards!:
520525

521526
:fileset_ex!:

x-pack/filebeat/module/cisco/_meta/docs.asciidoc

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This is a module for Cisco network device's logs and Cisco Umbrella. It includes
99
filesets for receiving logs over syslog or read from a file:
1010

1111
- `asa` fileset: supports Cisco ASA firewall logs.
12-
- `amp` fileset: supports Cisco Umbrella logs.
12+
- `amp` fileset: supports Cisco AMP API logs.
1313
- `ftd` fileset: supports Cisco Firepower Threat Defense logs.
1414
- `ios` fileset: supports Cisco IOS router and switch logs.
1515
- `nexus` fileset: supports Cisco Nexus switch logs.
@@ -443,9 +443,9 @@ Maximum duration before AWS API request will be interrupted. Default to be 120 s
443443
[float]
444444
==== `amp` fileset settings
445445

446-
The Cisco AMP fileset focuses on collecting events from your Cisco AMP/Cisco Securi Endpoint API.
446+
The Cisco AMP fileset focuses on collecting events from your Cisco AMP/Cisco Secure Endpoint API.
447447

448-
To configure the Cisco AMP fileset you will need to retrieve your client_id and client_key from the AMP dashboard.
448+
To configure the Cisco AMP fileset you will need to retrieve your `client_id` and `api_key` from the AMP dashboard.
449449
For more information on how to retrieve these credentials, please reference the https://api-docs.amp.cisco.com/api_resources?api_host=api.amp.cisco.com&api_version=v1[Cisco AMP API documentation].
450450

451451
The URL configured for the API depends on which region your AMP is located, currently there is 3 choices:
@@ -483,12 +483,13 @@ It is also possible to select how often Filebeat will check the Cisco AMP API. A
483483
var.first_interval: 200h
484484
var.interval: 60m
485485
var.request_timeout: 120s
486+
var.limit: 100
486487
487488
----
488489

489490
*`var.input`*::
490491

491-
The input from which messages are read. Supports httpjson(default) and file.
492+
The input from which messages are read. Supports httpjson.
492493

493494
*`var.url`*::
494495

@@ -511,6 +512,10 @@ timeout value for each request sent by Filebeat.
511512

512513
How far back you would want to collect events the first time the Filebeat module starts up. Supports amount in hours.
513514

515+
*`var.limit`*::
516+
517+
This value controls how many events are returned by the Cisco AMP API per page.
518+
514519
:has-dashboards!:
515520

516521
:fileset_ex!:

x-pack/filebeat/module/cisco/amp/_meta/fields.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@
1010
description: >
1111
The timestamp in Epoch nanoseconds.
1212
13-
- name: date
14-
type: date
15-
description: >
16-
The timestamp in ISO8601 format.
17-
1813
- name: event_type_id
1914
type: keyword
2015
description: >
@@ -241,12 +236,12 @@
241236
The id of the related incident for the threat hunting activity.
242237
243238
- name: threat_hunting.incident_end_time
244-
type: keyword
239+
type: date
245240
description: >
246241
When the threat hunt finalized or closed.
247242
248243
- name: threat_hunting.incident_start_time
249-
type: keyword
244+
type: date
250245
description: >
251246
When the threat hunt was initiated.
252247

x-pack/filebeat/module/cisco/amp/config/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ request.transforms:
1818
default: '[[ formatDate (now (parseDuration "-{{ .first_interval }}")) "2006-01-02T15:04:05-07:00" ]]'
1919
- set:
2020
target: url.params.limit
21-
value: 100
21+
value: {{ .limit }}
2222
request.rate_limit.limit: '[[ .last_response.header.Get "X-RateLimit-Limit" ]]'
2323
request.rate_limit.reset: '[[ .last_response.header.Get "X-RateLimit-Reset" ]]'
2424
request.rate_limit.remaining: '[[ .last_response.header.Get "X-RateLimit-Remaining" ]]'
@@ -68,4 +68,4 @@ processors:
6868
- add_fields:
6969
target: ''
7070
fields:
71-
ecs.version: 1.6.0
71+
ecs.version: 1.7.0

x-pack/filebeat/module/cisco/amp/ingest/pipeline.yml

Lines changed: 100 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
description: Pipeline for parsing checkpoint firewall logs
1+
description: Pipeline for parsing Cisco AMP logs
22
processors:
33

44
- remove:
@@ -54,7 +54,7 @@ processors:
5454
if: ctx?.cisco?.amp?.severity == 'High'
5555
- set:
5656
field: event.severity
57-
value: 3
57+
value: 4
5858
if: ctx?.cisco?.amp?.severity == 'Critical'
5959
- set:
6060
field: event.severity
@@ -94,11 +94,11 @@ processors:
9494
ignore_missing: true
9595
- set:
9696
field: network.direction
97-
value: outbound
97+
value: egress
9898
if: "ctx?.cisco?.amp?.network_info?.nfm?.direction == 'Outgoing connection from'"
9999
- set:
100100
field: network.direction
101-
value: outbound
101+
value: ingress
102102
if: "ctx?.cisco?.amp?.network_info?.nfm?.direction != null && ctx?.cisco?.amp?.network_info?.nfm?.direction != 'Outgoing connection from'"
103103

104104
#####################
@@ -114,32 +114,24 @@ processors:
114114
########################
115115
- rename:
116116
field: cisco.amp.network_info.local_ip
117-
target_field: source.address
117+
target_field: source.ip
118118
ignore_missing: true
119119
- rename:
120120
field: cisco.amp.network_info.local_port
121121
target_field: source.port
122122
ignore_missing: true
123-
- set:
124-
field: source.ip
125-
value: "{{ source.address }}"
126-
if: ctx?.source?.address != null
127123

128124
#############################
129125
## ECS Destination Mapping ##
130126
#############################
131127
- rename:
132128
field: cisco.amp.network_info.remote_ip
133-
target_field: destination.address
129+
target_field: destination.ip
134130
ignore_missing: true
135131
- rename:
136132
field: cisco.amp.network_info.remote_port
137133
target_field: destination.port
138134
ignore_missing: true
139-
- set:
140-
field: destination.ip
141-
value: "{{ destination.address }}"
142-
if: ctx?.destination?.address != null
143135

144136
######################
145137
## ECS File Mapping ##
@@ -263,6 +255,10 @@ processors:
263255
value: "{{ cisco.amp.network_info.parent.identity.sha1 }}"
264256
if: ctx?.cisco?.amp?.network_info?.parent?.identity?.sha1 != null
265257
allow_duplicates: false
258+
- append:
259+
field: related.hosts
260+
value: "{{ host.name }}"
261+
if: ctx?.host?.name != null
266262
- append:
267263
field: related.ip
268264
value: "{{ source.ip }}"
@@ -271,6 +267,10 @@ processors:
271267
field: related.ip
272268
value: "{{ destination.ip }}"
273269
if: ctx?.destination?.ip != null
270+
- append:
271+
field: related.ip
272+
value: "{{ cisco.amp.computer.external_ip }}"
273+
if: ctx?.cisco?.amp?.computer?.external_ip != null
274274
- foreach:
275275
field: cisco.amp.computer.network_addresses
276276
processor:
@@ -293,9 +293,95 @@ processors:
293293
value: "{{ _ingest._value.cve }}"
294294
if: ctx?.cisco?.amp?.vulnerabilities != null
295295

296+
#############
297+
## GeoIP ##
298+
#############
299+
- geoip:
300+
field: source.ip
301+
target_field: source.geo
302+
ignore_missing: true
303+
if: "ctx.source?.geo == null"
304+
- geoip:
305+
field: destination.ip
306+
target_field: destination.geo
307+
ignore_missing: true
308+
if: "ctx.destination?.geo == null"
309+
- geoip:
310+
database_file: GeoLite2-ASN.mmdb
311+
field: source.ip
312+
target_field: source.as
313+
properties:
314+
- asn
315+
- organization_name
316+
ignore_missing: true
317+
- geoip:
318+
database_file: GeoLite2-ASN.mmdb
319+
field: destination.ip
320+
target_field: destination.as
321+
properties:
322+
- asn
323+
- organization_name
324+
ignore_missing: true
325+
- rename:
326+
field: source.as.asn
327+
target_field: source.as.number
328+
ignore_missing: true
329+
- rename:
330+
field: source.as.organization_name
331+
target_field: source.as.organization.name
332+
ignore_missing: true
333+
- rename:
334+
field: destination.as.asn
335+
target_field: destination.as.number
336+
ignore_missing: true
337+
- rename:
338+
field: destination.as.organization_name
339+
target_field: destination.as.organization.name
340+
ignore_missing: true
341+
296342
#############
297343
## Cleanup ##
298344
#############
345+
- date:
346+
field: cisco.amp.threat_hunting.incident_start_time
347+
target_field: cisco.amp.threat_hunting.incident_start_time
348+
formats:
349+
- UNIX
350+
ignore_failure: true
351+
if: ctx?.cisco?.amp?.threat_hunting?.incident_start_time != null
352+
- date:
353+
field: cisco.amp.threat_hunting.incident_end_time
354+
target_field: cisco.amp.threat_hunting.incident_end_time
355+
formats:
356+
- UNIX
357+
ignore_failure: true
358+
if: ctx?.cisco?.amp?.threat_hunting?.incident_end_time != null
359+
360+
- script:
361+
lang: painless
362+
if: ctx?.json != null
363+
source: |
364+
void handleMap(Map map) {
365+
for (def x : map.values()) {
366+
if (x instanceof Map) {
367+
handleMap(x);
368+
} else if (x instanceof List) {
369+
handleList(x);
370+
}
371+
}
372+
map.values().removeIf(v -> v == null);
373+
}
374+
void handleList(List list) {
375+
for (def x : list) {
376+
if (x instanceof Map) {
377+
handleMap(x);
378+
} else if (x instanceof List) {
379+
handleList(x);
380+
}
381+
}
382+
}
383+
handleMap(ctx);
384+
299385
- remove:
300386
field:
301387
- cisco.amp.timestamp

x-pack/filebeat/module/cisco/amp/manifest.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ var:
1010
- name: ssl
1111
- name: request_timeout
1212
default: 60s
13+
- name: limit
14+
default: 100
1315
- name: client_id
1416
- name: api_key
1517
- name: first_interval

x-pack/filebeat/module/cisco/amp/test/cisco_amp.ndjson.log-expected.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,11 @@
6363
"9a8557b98ed1469272fa0ace91d63477",
6464
"d0c4192b65e36553fvfd2b83f3113f6ae8390baa"
6565
],
66+
"related.hosts": [
67+
"testhost"
68+
],
6669
"related.ip": [
70+
"8.8.8.8",
6771
"192.168.196.22",
6872
"192.168.120.1",
6973
"192.168.160.1"

0 commit comments

Comments
 (0)