Skip to content

Commit f7894d4

Browse files
authored
entityanalytics_okta,okta: record okta domain into host.name in ingested documents (#13721)
This change affects two packages, entityanalytics_okta and okta in a coordinated way. entityanalytics_okta: Rather than waiting for a stack release this adds the okta_domain value via a beats processor, placing it in a location that is unlikely to collide with data in the input's event data in the future. Move this to host.name in ingest, falling back to reasonable location on failure. okta: This records the Okta Domain value from the Okta API URL provided by the configuration. This is chosen over using the okta_domain value since the URL is always present, so this simplifies the logic. The URL is passed outside the event.original to avoid collision. This means that it does not end up in the event.original. The actual Okta Domain is obtain from the URL in the ingest pipeline and then placed gingerly in host.name if possible, falling back to the same locations used in the entityanalytics_okta integration in order to harmonise the two integrations. The work to do this is done last in the pipeline to allow an unlikely failure to not interfere with other parts of the pipeline, but to provide an informative error in that case that that does happen.
1 parent ce3aa31 commit f7894d4

File tree

17 files changed

+261
-33
lines changed

17 files changed

+261
-33
lines changed

packages/entityanalytics_okta/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.3.0"
3+
changes:
4+
- description: Retain Okta Domain value in `host.name` where possible.
5+
type: enhancement
6+
link: https://github.com/elastic/integrations/pull/13721
27
- version: "2.2.1"
38
changes:
49
- description: Fix default request trace enabled behavior.

packages/entityanalytics_okta/data_stream/entity/_dev/test/pipeline/test-device.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
}
9797
]
9898
},
99+
"okta_domain": "trial-xxxxxxx-admin.okta.com",
99100
"device": {
100101
"id": "guo4a5u7YAHhjXrMK0g4"
101102
},

packages/entityanalytics_okta/data_stream/entity/_dev/test/pipeline/test-device.json-expected.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,14 @@
7171
"host"
7272
],
7373
"kind": "asset",
74-
"original": "{\"input\":{\"type\":\"entity-analytics\"},\"@timestamp\":\"2023-06-13T07:12:17.341Z\",\"ecs\":{\"version\":\"8.11.0\"},\"event\":{\"kind\":\"asset\"},\"device\":{\"id\":\"guo4a5u7YAHhjXrMK0g4\"},\"okta\":{\"resourceAlternateId\":null,\"lastUpdated\":\"2019-10-02T18:03:07.000Z\",\"resourceDisplayName\":{\"sensitive\":false,\"value\":\"Example Device name 1\"},\"resourceId\":\"guo4a5u7YAHhjXrMK0g4\",\"_links\":{\"activate\":{\"hints\":{\"allow\":[\"POST\"]},\"href\":\"https://localhost/api/v1/devices/guo4a5u7YAHhjXrMK0g4/lifecycle/activate\"},\"self\":{\"hints\":{\"allow\":[\"GET\",\"PATCH\",\"PUT\"]},\"href\":\"https://localhost/api/v1/devices/guo4a5u7YAHhjXrMK0g4\"},\"users\":{\"hints\":{\"allow\":[\"GET\"]},\"href\":\"https://localhost/api/v1/devices/guo4a5u7YAHhjXrMK0g4/users\"}},\"created\":\"2019-10-02T18:03:07.000Z\",\"profile\":{\"serialNumber\":\"XXDDRFCFRGF3M8MD6D\",\"displayName\":\"Example Device name 1\",\"registered\":true,\"diskEncryptionType\":\"ALL_INTERNAL_VOLUMES\",\"secureHardwarePresent\":false,\"platform\":\"WINDOWS\",\"sid\":\"S-1-11-111\"},\"id\":\"guo4a5u7YAHhjXrMK0g4\",\"users\":[{\"lastLogin\":\"2013-06-24T17:39:19.000Z\",\"lastUpdated\":\"2013-06-27T16:35:28.000Z\",\"passwordChanged\":\"2013-06-24T16:39:19.000Z\",\"credentials\":{\"provider\":{\"name\":\"OKTA\",\"type\":\"OKTA\"},\"recovery_question\":{}},\"created\":\"2013-06-24T16:39:18.000Z\",\"profile\":{\"profileUrl\":\"http://www.example.com/profile\",\"lastName\":\"Brock\",\"zipCode\":\"94107\",\"preferredLanguage\":\"en-US\",\"city\":\"San Francisco\",\"costCenter\":\"10\",\"displayName\":\"Isaac Brock\",\"nickName\":\"issac\",\"secondEmail\":\"[email protected]\",\"login\":\"[email protected]\",\"title\":\"Director\",\"employeeNumber\":\"187\",\"division\":\"R&D\",\"firstName\":\"Isaac\",\"primaryPhone\":\"+1-555-514-1337\",\"mobilePhone\":\"+1-555-415-1337\",\"streetAddress\":\"301 Brannan St.\",\"countryCode\":\"US\",\"organization\":\"Okta\",\"state\":\"CA\",\"userType\":\"Employee\",\"department\":\"Engineering\",\"email\":\"[email protected]\"},\"statusChanged\":\"2013-06-24T16:39:19.000Z\",\"id\":\"00ub0oNGTSWTBKOLGLNR\",\"activated\":\"2013-06-24T16:39:19.000Z\",\"status\":\"ACTIVE\"}],\"resourceType\":\"UDDevice\",\"status\":\"ACTIVE\"},\"tags\":[\"preserve_original_event\",\"preserve_duplicate_custom_fields\"],\"_index\":\"logs-entityanalytics_okta.entity-default\",\"_id\":\"_id\",\"_version\":-3}",
74+
"original": "{\"input\":{\"type\":\"entity-analytics\"},\"@timestamp\":\"2023-06-13T07:12:17.341Z\",\"ecs\":{\"version\":\"8.11.0\"},\"okta_domain\":\"trial-xxxxxxx-admin.okta.com\",\"event\":{\"kind\":\"asset\"},\"device\":{\"id\":\"guo4a5u7YAHhjXrMK0g4\"},\"okta\":{\"resourceAlternateId\":null,\"lastUpdated\":\"2019-10-02T18:03:07.000Z\",\"resourceDisplayName\":{\"sensitive\":false,\"value\":\"Example Device name 1\"},\"resourceId\":\"guo4a5u7YAHhjXrMK0g4\",\"_links\":{\"activate\":{\"hints\":{\"allow\":[\"POST\"]},\"href\":\"https://localhost/api/v1/devices/guo4a5u7YAHhjXrMK0g4/lifecycle/activate\"},\"self\":{\"hints\":{\"allow\":[\"GET\",\"PATCH\",\"PUT\"]},\"href\":\"https://localhost/api/v1/devices/guo4a5u7YAHhjXrMK0g4\"},\"users\":{\"hints\":{\"allow\":[\"GET\"]},\"href\":\"https://localhost/api/v1/devices/guo4a5u7YAHhjXrMK0g4/users\"}},\"created\":\"2019-10-02T18:03:07.000Z\",\"profile\":{\"serialNumber\":\"XXDDRFCFRGF3M8MD6D\",\"displayName\":\"Example Device name 1\",\"registered\":true,\"diskEncryptionType\":\"ALL_INTERNAL_VOLUMES\",\"secureHardwarePresent\":false,\"platform\":\"WINDOWS\",\"sid\":\"S-1-11-111\"},\"id\":\"guo4a5u7YAHhjXrMK0g4\",\"users\":[{\"lastLogin\":\"2013-06-24T17:39:19.000Z\",\"lastUpdated\":\"2013-06-27T16:35:28.000Z\",\"passwordChanged\":\"2013-06-24T16:39:19.000Z\",\"credentials\":{\"provider\":{\"name\":\"OKTA\",\"type\":\"OKTA\"},\"recovery_question\":{}},\"created\":\"2013-06-24T16:39:18.000Z\",\"profile\":{\"profileUrl\":\"http://www.example.com/profile\",\"lastName\":\"Brock\",\"zipCode\":\"94107\",\"preferredLanguage\":\"en-US\",\"city\":\"San Francisco\",\"costCenter\":\"10\",\"displayName\":\"Isaac Brock\",\"nickName\":\"issac\",\"secondEmail\":\"[email protected]\",\"login\":\"[email protected]\",\"title\":\"Director\",\"employeeNumber\":\"187\",\"division\":\"R&D\",\"firstName\":\"Isaac\",\"primaryPhone\":\"+1-555-514-1337\",\"mobilePhone\":\"+1-555-415-1337\",\"streetAddress\":\"301 Brannan St.\",\"countryCode\":\"US\",\"organization\":\"Okta\",\"state\":\"CA\",\"userType\":\"Employee\",\"department\":\"Engineering\",\"email\":\"[email protected]\"},\"statusChanged\":\"2013-06-24T16:39:19.000Z\",\"id\":\"00ub0oNGTSWTBKOLGLNR\",\"activated\":\"2013-06-24T16:39:19.000Z\",\"status\":\"ACTIVE\"}],\"resourceType\":\"UDDevice\",\"status\":\"ACTIVE\"},\"tags\":[\"preserve_original_event\",\"preserve_duplicate_custom_fields\"],\"_index\":\"logs-entityanalytics_okta.entity-default\",\"_id\":\"_id\",\"_version\":-3}",
7575
"type": [
7676
"info"
7777
]
7878
},
79+
"host": {
80+
"name": "trial-xxxxxxx-admin.okta.com"
81+
},
7982
"input": {
8083
"type": "entity-analytics"
8184
},

packages/entityanalytics_okta/data_stream/entity/_dev/test/pipeline/test-user.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
"recovery_question": {}
4545
}
4646
},
47+
"okta_domain": "trial-xxxxxxx-admin.okta.com",
4748
"groups": [
4849
{
4950
"id": "OGYzMDMwYjFmODBiNjli",

packages/entityanalytics_okta/data_stream/entity/_dev/test/pipeline/test-user.json-expected.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,15 @@
8383
"iam"
8484
],
8585
"kind": "asset",
86-
"original": "{\"input\":{\"type\":\"entity-analytics\"},\"@timestamp\":\"2023-06-13T07:12:17.341Z\",\"ecs\":{\"version\":\"8.11.0\"},\"groups\":[{\"profile\":{\"name\":\"Everyone\",\"description\":\"All users in your organization\"},\"id\":\"OGYzMDMwYjFmODBiNjli\"}],\"event\":{\"kind\":\"asset\"},\"okta\":{\"lastLogin\":\"2013-06-24T17:39:19.000Z\",\"lastUpdated\":\"2013-06-27T16:35:28.000Z\",\"passwordChanged\":\"2013-06-24T16:39:19.000Z\",\"credentials\":{\"provider\":{\"name\":\"OKTA\",\"type\":\"OKTA\"},\"recovery_question\":{}},\"created\":\"2013-06-24T16:39:18.000Z\",\"profile\":{\"profileUrl\":\"http://www.example.com/profile\",\"lastName\":\"Brock\",\"zipCode\":\"94107\",\"preferredLanguage\":\"en-US\",\"city\":\"San Francisco\",\"costCenter\":\"10\",\"displayName\":\"Isaac Brock\",\"nickName\":\"issac\",\"secondEmail\":\"[email protected]\",\"login\":\"[email protected]\",\"title\":\"Director\",\"employeeNumber\":\"187\",\"division\":\"R&D\",\"firstName\":\"Isaac\",\"primaryPhone\":\"+1-555-514-1337\",\"mobilePhone\":\"+1-555-415-1337\",\"streetAddress\":\"301 Brannan St.\",\"countryCode\":\"US\",\"organization\":\"Okta\",\"state\":\"CA\",\"userType\":\"Employee\",\"department\":\"Engineering\",\"email\":\"[email protected]\"},\"statusChanged\":\"2013-06-24T16:39:19.000Z\",\"id\":\"00ub0oNGTSWTBKOLGLNR\",\"activated\":\"2013-06-24T16:39:19.000Z\",\"status\":\"ACTIVE\"},\"user\":{\"id\":\"00u5tvodynDjUCNKn697\"},\"tags\":[\"preserve_original_event\",\"preserve_duplicate_custom_fields\"],\"_index\":\"logs-entityanalytics_okta.entity-default\",\"_id\":\"_id\",\"_version\":-3}",
86+
"original": "{\"input\":{\"type\":\"entity-analytics\"},\"@timestamp\":\"2023-06-13T07:12:17.341Z\",\"ecs\":{\"version\":\"8.11.0\"},\"groups\":[{\"profile\":{\"name\":\"Everyone\",\"description\":\"All users in your organization\"},\"id\":\"OGYzMDMwYjFmODBiNjli\"}],\"okta_domain\":\"trial-xxxxxxx-admin.okta.com\",\"event\":{\"kind\":\"asset\"},\"okta\":{\"lastLogin\":\"2013-06-24T17:39:19.000Z\",\"lastUpdated\":\"2013-06-27T16:35:28.000Z\",\"passwordChanged\":\"2013-06-24T16:39:19.000Z\",\"credentials\":{\"provider\":{\"name\":\"OKTA\",\"type\":\"OKTA\"},\"recovery_question\":{}},\"created\":\"2013-06-24T16:39:18.000Z\",\"profile\":{\"profileUrl\":\"http://www.example.com/profile\",\"lastName\":\"Brock\",\"zipCode\":\"94107\",\"preferredLanguage\":\"en-US\",\"city\":\"San Francisco\",\"costCenter\":\"10\",\"displayName\":\"Isaac Brock\",\"nickName\":\"issac\",\"secondEmail\":\"[email protected]\",\"login\":\"[email protected]\",\"title\":\"Director\",\"employeeNumber\":\"187\",\"division\":\"R&D\",\"firstName\":\"Isaac\",\"primaryPhone\":\"+1-555-514-1337\",\"mobilePhone\":\"+1-555-415-1337\",\"streetAddress\":\"301 Brannan St.\",\"countryCode\":\"US\",\"organization\":\"Okta\",\"state\":\"CA\",\"userType\":\"Employee\",\"department\":\"Engineering\",\"email\":\"[email protected]\"},\"statusChanged\":\"2013-06-24T16:39:19.000Z\",\"id\":\"00ub0oNGTSWTBKOLGLNR\",\"activated\":\"2013-06-24T16:39:19.000Z\",\"status\":\"ACTIVE\"},\"user\":{\"id\":\"00u5tvodynDjUCNKn697\"},\"tags\":[\"preserve_original_event\",\"preserve_duplicate_custom_fields\"],\"_index\":\"logs-entityanalytics_okta.entity-default\",\"_id\":\"_id\",\"_version\":-3}",
8787
"type": [
8888
"user",
8989
"info"
9090
]
9191
},
92+
"host": {
93+
"name": "trial-xxxxxxx-admin.okta.com"
94+
},
9295
"input": {
9396
"type": "entity-analytics"
9497
},

packages/entityanalytics_okta/data_stream/entity/agent/stream/entity-analytics.yml.hbs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ tags:
3333
{{#contains "forwarded" tags}}
3434
publisher_pipeline.disable_host: true
3535
{{/contains}}
36-
{{#if processors}}
3736
processors:
37+
{{#if processors}}
3838
{{processors}}
3939
{{/if}}
40+
- add_fields:
41+
target: ''
42+
fields:
43+
okta_domain: {{okta_domain}}

packages/entityanalytics_okta/data_stream/entity/elasticsearch/ingest_pipeline/default.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@ processors:
2323
name: '{{ IngestPipeline "device" }}'
2424
tag: pipeline_to_device
2525
if: ctx.device?.id != null
26+
- rename:
27+
field: okta_domain
28+
target_field: host.name
29+
ignore_missing: true
30+
on_failure:
31+
- rename:
32+
field: okta_domain
33+
target_field: okta.okta_domain
34+
ignore_failure: true
2635

2736
- script:
2837
lang: painless

packages/entityanalytics_okta/data_stream/entity/sample_event.json

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,41 @@
11
{
2-
"@timestamp": "2025-02-17T01:32:37.018Z",
2+
"@timestamp": "2025-04-29T23:45:56.269Z",
33
"agent": {
4-
"ephemeral_id": "5565e14c-c3d1-4168-9860-fb280f704fad",
5-
"id": "f1b6848f-87f5-4d0e-8dae-49fb70d285f6",
6-
"name": "elastic-agent-11615",
4+
"ephemeral_id": "039aec05-a412-489e-a506-5f4fdf78b738",
5+
"id": "31bbbbfc-763f-4e44-959f-8e97a01f2dbd",
6+
"name": "elastic-agent-68980",
77
"type": "filebeat",
88
"version": "8.15.0"
99
},
1010
"data_stream": {
1111
"dataset": "entityanalytics_okta.entity",
12-
"namespace": "71124",
12+
"namespace": "87097",
1313
"type": "logs"
1414
},
1515
"ecs": {
1616
"version": "8.11.0"
1717
},
1818
"elastic_agent": {
19-
"id": "f1b6848f-87f5-4d0e-8dae-49fb70d285f6",
19+
"id": "31bbbbfc-763f-4e44-959f-8e97a01f2dbd",
2020
"snapshot": false,
2121
"version": "8.15.0"
2222
},
2323
"event": {
2424
"action": "started",
2525
"agent_id_status": "verified",
2626
"dataset": "entityanalytics_okta.entity",
27-
"ingested": "2025-02-17T01:32:38Z",
27+
"ingested": "2025-04-29T23:45:57Z",
2828
"kind": "asset",
29-
"start": "2025-02-17T01:32:37.018Z"
29+
"start": "2025-04-29T23:45:56.269Z"
30+
},
31+
"host": {
32+
"name": "trial-xxxxxxx-admin.okta.com"
3033
},
3134
"input": {
3235
"type": "entity-analytics"
3336
},
3437
"labels": {
35-
"identity_source": "entity-analytics-entityanalytics_okta.entity-e600b1a8-23ab-4aa5-9694-d245bc06b6ed"
38+
"identity_source": "entity-analytics-entityanalytics_okta.entity-aa7bbba7-39b6-4bad-80f5-6ed793be029b"
3639
},
3740
"tags": [
3841
"preserve_original_event",

packages/entityanalytics_okta/manifest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
format_version: "3.0.2"
22
name: entityanalytics_okta
33
title: Okta Entity Analytics
4-
version: "2.2.1"
4+
version: "2.3.0"
55
description: "Collect Identities from Okta with Elastic Agent."
66
type: integration
77
categories:

packages/okta/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: "3.7.0"
3+
changes:
4+
- description: Retain Okta Domain value in `host.name` where possible.
5+
type: enhancement
6+
link: https://github.com/elastic/integrations/pull/13721
27
- version: "3.6.1"
38
changes:
49
- description: Fix default request trace enabled behavior.

0 commit comments

Comments
 (0)