Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Filebeat] Parse additonal debug data fields for Okta module #25818

Merged
merged 8 commits into from
Jun 24, 2021
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Add `include_s3_metadata` config option to the `aws-s3` input for including object metadata in events. {pull}26267[26267]
- RFC 5424 and UNIX socket support in the Syslog input are now GA {pull}26293[26293]
- Update grok patterns for HA Proxy module {issue}25827[25827] {pull}25835[25835]
- Update Okta module to parse additional fields to `okta.debug_context.debug_data`. {issue}25689[25689] {pull}25818[25818]

*Heartbeat*

Expand Down
127 changes: 127 additions & 0 deletions filebeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -113109,6 +113109,133 @@ type: keyword

--

[float]
=== suspicious_activity

The suspicious activity fields from the debug data.



*`okta.debug_context.debug_data.suspicious_activity.browser`*::
+
--
The URL.


type: keyword

--

*`okta.debug_context.debug_data.suspicious_activity.event_city`*::
+
--
The URL.


type: keyword

--

*`okta.debug_context.debug_data.suspicious_activity.event_country`*::
+
--
The URL.


type: keyword

--

*`okta.debug_context.debug_data.suspicious_activity.event_id`*::
+
--
The URL.


type: keyword

--

*`okta.debug_context.debug_data.suspicious_activity.event_ip`*::
+
--
The URL.


type: ip

--

*`okta.debug_context.debug_data.suspicious_activity.event_latitude`*::
+
--
The URL.


type: float

--

*`okta.debug_context.debug_data.suspicious_activity.event_longitude`*::
+
--
The URL.


type: float

--

*`okta.debug_context.debug_data.suspicious_activity.event_state`*::
+
--
The URL.


type: keyword

--

*`okta.debug_context.debug_data.suspicious_activity.event_transaction_id`*::
+
--
The URL.


type: keyword

--

*`okta.debug_context.debug_data.suspicious_activity.event_type`*::
+
--
The URL.


type: keyword

--

*`okta.debug_context.debug_data.suspicious_activity.os`*::
+
--
The URL.


type: keyword

--

*`okta.debug_context.debug_data.suspicious_activity.timestamp`*::
+
--
The URL.


type: date

--

[float]
=== authentication_context

Expand Down
2 changes: 1 addition & 1 deletion x-pack/filebeat/module/okta/fields.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

67 changes: 67 additions & 0 deletions x-pack/filebeat/module/okta/system/_meta/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,73 @@
description: >
The URL.
- name: suspicious_activity
description: >
The suspicious activity fields from the debug data.
type: group
fields:

- name: browser
type: keyword
description: >
The URL.
- name: event_city
type: keyword
description: >
The URL.
- name: event_country
type: keyword
description: >
The URL.
- name: event_id
type: keyword
description: >
The URL.
- name: event_ip
type: ip
description: >
The URL.
- name: event_latitude
type: float
description: >
The URL.
- name: event_longitude
type: float
description: >
The URL.
- name: event_state
type: keyword
description: >
The URL.
- name: event_transaction_id
type: keyword
description: >
The URL.
- name: event_type
type: keyword
description: >
The URL.
- name: os
type: keyword
description: >
The URL.
- name: timestamp
type: date
description: >
The URL.
- name: authentication_context
title: Authentication Context
short: Fields that let you store information about authentication context.
Expand Down
104 changes: 84 additions & 20 deletions x-pack/filebeat/module/okta/system/ingest/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,6 @@ processors:
- set:
field: event.ingested
value: "{{_ingest.timestamp}}"
- script:
description: Drops null/empty values recursively
lang: painless
source: |
boolean drop(Object o) {
if (o == null || o == "") {
return true;
} else if (o instanceof Map) {
((Map) o).values().removeIf(v -> drop(v));
return (((Map) o).size() == 0);
} else if (o instanceof List) {
((List) o).removeIf(v -> drop(v));
return (((List) o).length == 0);
}
return false;
}
drop(ctx);
- remove:
field: message
ignore_missing: true
Expand Down Expand Up @@ -265,6 +248,72 @@ processors:
target_field: okta.debug_context.debug_data.url
ignore_missing: true
ignore_failure: true
- uri_parts:
field: okta.debug_context.debug_data.url
ignore_failure: true
if: ctx?.okta?.debug_context?.debug_data?.url != null
- rename:
field: json.debugContext.debugData.suspiciousActivityBrowser
target_field: okta.debug_context.debug_data.suspicious_activity.browser
ignore_missing: true
ignore_failure: true
- rename:
ignore_failure: true
field: json.debugContext.debugData.suspiciousActivityEventCity
target_field: okta.debug_context.debug_data.suspicious_activity.event_city
ignore_missing: true
- rename:
field: json.debugContext.debugData.suspiciousActivityEventCountry
target_field: okta.debug_context.debug_data.suspicious_activity.event_country
ignore_missing: true
ignore_failure: true
- rename:
field: json.debugContext.debugData.suspiciousActivityEventId
target_field: okta.debug_context.debug_data.suspicious_activity.event_id
ignore_missing: true
ignore_failure: true
- rename:
field: json.debugContext.debugData.suspiciousActivityEventIp
target_field: okta.debug_context.debug_data.suspicious_activity.event_ip
ignore_missing: true
ignore_failure: true
- rename:
field: json.debugContext.debugData.suspiciousActivityEventLatitude
target_field: okta.debug_context.debug_data.suspicious_activity.event_latitude
ignore_missing: true
ignore_failure: true
- rename:
field: json.debugContext.debugData.suspiciousActivityEventLongitude
target_field: okta.debug_context.debug_data.suspicious_activity.event_longitude
ignore_missing: true
ignore_failure: true
- rename:
field: json.debugContext.debugData.suspiciousActivityEventState
target_field: okta.debug_context.debug_data.suspicious_activity.event_state
ignore_missing: true
ignore_failure: true
- rename:
field: json.debugContext.debugData.suspiciousActivityEventTransactionId
target_field: okta.debug_context.debug_data.suspicious_activity.event_transaction_id
ignore_missing: true
ignore_failure: true
- rename:
field: json.debugContext.debugData.suspiciousActivityEventType
target_field: okta.debug_context.debug_data.suspicious_activity.event_type
ignore_missing: true
ignore_failure: true
- rename:
field: json.debugContext.debugData.suspiciousActivityOs
target_field: okta.debug_context.debug_data.suspicious_activity.os
ignore_missing: true
ignore_failure: true
- date:
field: json.debugContext.debugData.suspiciousActivityTimestamp
target_field: okta.debug_context.debug_data.suspicious_activity.timestamp
ignore_failure: true
formats:
- ISO8601
if: ctx?.json?.debugContext?.debugData?.suspiciousActivityTimestamp != null
- rename:
field: json.authenticationContext.authenticationProvider
target_field: okta.authentication_context.authentication_provider
Expand Down Expand Up @@ -452,6 +501,7 @@ processors:
field:
- okta_target_user
- okta_target_group
- json
ignore_missing: true
- set:
field: client.user.id
Expand Down Expand Up @@ -498,9 +548,6 @@ processors:
value: "{{destination.ip}}"
allow_duplicates: false
if: ctx?.destination?.ip != null
- remove:
field: json
ignore_missing: true
- user_agent:
field: user_agent.original
ignore_missing: true
Expand Down Expand Up @@ -544,6 +591,23 @@ processors:
field: destination.as.organization_name
target_field: destination.as.organization.name
ignore_missing: true
- script:
description: Drops null/empty values recursively
lang: painless
source: |
boolean drop(Object o) {
if (o == null || o == "") {
return true;
} else if (o instanceof Map) {
((Map) o).values().removeIf(v -> drop(v));
return (((Map) o).size() == 0);
} else if (o instanceof List) {
((List) o).removeIf(v -> drop(v));
return (((List) o).length == 0);
}
return false;
}
drop(ctx);

on_failure:
- set:
Expand Down
Loading