Skip to content

Commit 54715ff

Browse files
committed
okta: record the okta domain in events from input
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 8205170 commit 54715ff

File tree

8 files changed

+219
-20
lines changed

8 files changed

+219
-20
lines changed

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.0"
38
changes:
49
- description: Set `user.name` from Okta `actor.alternateId` field without modification.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"events": [
3+
{
4+
"message": "{\"actor\":{\"alternateId\":\"username@elastic.co\",\"detailEntry\":null,\"displayName\":\"xxxxxx\",\"id\":\"00u1abvz4pYqdM8ms4x6\",\"type\":\"User\"},\"authenticationContext\":{\"authenticationProvider\":null,\"authenticationStep\":0,\"credentialProvider\":null,\"credentialType\":null,\"externalSessionId\":\"102nZHzd6OHSfGG51vsoc22gw\",\"interface\":null,\"issuer\":null},\"client\":{\"device\":\"Computer\",\"geographicalContext\":{\"city\":\"Dublin\",\"country\":\"United States\",\"geolocation\":{\"lat\":37.7201,\"lon\":-121.919},\"postalCode\":\"94568\",\"state\":\"California\"},\"id\":null,\"ipAddress\":\"175.16.199.1\",\"userAgent\":{\"browser\":\"FIREFOX\",\"os\":\"Mac OS X\",\"rawUserAgent\":\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:72.0) Gecko/20100101 Firefox/72.0\"},\"zone\":\"null\"},\"debugContext\":{\"debugData\":{\"authnRequestId\":\"XkcAsWb8WjwDP76xh@1v8wAABp0\",\"requestId\":\"XkccyyMli2Uay2I93ZgRzQAAB0c\",\"requestUri\":\"/login/signout\",\"threatSuspected\":\"false\",\"url\":\"/login/signout?message=login_page_messages.session_has_expired\"}},\"displayMessage\":\"User logout from Okta\",\"eventType\":\"user.session.end\",\"legacyEventType\":\"core.user_auth.logout_success\",\"outcome\":{\"reason\":null,\"result\":\"SUCCESS\"},\"published\":\"2020-02-14T22:18:51.843Z\",\"request\":{\"ipChain\":[{\"geographicalContext\":{\"city\":\"Dublin\",\"country\":\"United States\",\"geolocation\":{\"lat\":37.7201,\"lon\":-121.919},\"postalCode\":\"94568\",\"state\":\"California\"},\"ip\":\"175.16.199.1\",\"source\":null,\"version\":\"V4\"}]},\"securityContext\":{\"asNumber\":null,\"asOrg\":null,\"domain\":null,\"isProxy\":null,\"isp\":null},\"severity\":\"INFO\",\"target\":null,\"transaction\":{\"detail\":{},\"id\":\"XkccyyMli2Uay2I93ZgRzQAAB0c\",\"type\":\"WEB\"},\"uuid\":\"faf7398a-4f77-11ea-97fb-5925e98228bd\",\"version\":\"0\"}",
5+
"okta_url": "https://trial-xxxxxxx-admin.okta.com/api/v1/logs"
6+
}
7+
]
8+
}
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
{
2+
"expected": [
3+
{
4+
"@timestamp": "2020-02-14T22:18:51.843Z",
5+
"client": {
6+
"geo": {
7+
"city_name": "Dublin",
8+
"country_name": "United States",
9+
"location": {
10+
"lat": 37.7201,
11+
"lon": -121.919
12+
},
13+
"region_name": "California"
14+
},
15+
"ip": "175.16.199.1",
16+
"user": {
17+
"full_name": "xxxxxx",
18+
"id": "00u1abvz4pYqdM8ms4x6",
19+
"name": "username@elastic.co"
20+
}
21+
},
22+
"ecs": {
23+
"version": "8.11.0"
24+
},
25+
"event": {
26+
"action": "user.session.end",
27+
"category": [
28+
"authentication",
29+
"session"
30+
],
31+
"id": "faf7398a-4f77-11ea-97fb-5925e98228bd",
32+
"kind": "event",
33+
"original": "{\"actor\":{\"alternateId\":\"username@elastic.co\",\"detailEntry\":null,\"displayName\":\"xxxxxx\",\"id\":\"00u1abvz4pYqdM8ms4x6\",\"type\":\"User\"},\"authenticationContext\":{\"authenticationProvider\":null,\"authenticationStep\":0,\"credentialProvider\":null,\"credentialType\":null,\"externalSessionId\":\"102nZHzd6OHSfGG51vsoc22gw\",\"interface\":null,\"issuer\":null},\"client\":{\"device\":\"Computer\",\"geographicalContext\":{\"city\":\"Dublin\",\"country\":\"United States\",\"geolocation\":{\"lat\":37.7201,\"lon\":-121.919},\"postalCode\":\"94568\",\"state\":\"California\"},\"id\":null,\"ipAddress\":\"175.16.199.1\",\"userAgent\":{\"browser\":\"FIREFOX\",\"os\":\"Mac OS X\",\"rawUserAgent\":\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:72.0) Gecko/20100101 Firefox/72.0\"},\"zone\":\"null\"},\"debugContext\":{\"debugData\":{\"authnRequestId\":\"XkcAsWb8WjwDP76xh@1v8wAABp0\",\"requestId\":\"XkccyyMli2Uay2I93ZgRzQAAB0c\",\"requestUri\":\"/login/signout\",\"threatSuspected\":\"false\",\"url\":\"/login/signout?message=login_page_messages.session_has_expired\"}},\"displayMessage\":\"User logout from Okta\",\"eventType\":\"user.session.end\",\"legacyEventType\":\"core.user_auth.logout_success\",\"outcome\":{\"reason\":null,\"result\":\"SUCCESS\"},\"published\":\"2020-02-14T22:18:51.843Z\",\"request\":{\"ipChain\":[{\"geographicalContext\":{\"city\":\"Dublin\",\"country\":\"United States\",\"geolocation\":{\"lat\":37.7201,\"lon\":-121.919},\"postalCode\":\"94568\",\"state\":\"California\"},\"ip\":\"175.16.199.1\",\"source\":null,\"version\":\"V4\"}]},\"securityContext\":{\"asNumber\":null,\"asOrg\":null,\"domain\":null,\"isProxy\":null,\"isp\":null},\"severity\":\"INFO\",\"target\":null,\"transaction\":{\"detail\":{},\"id\":\"XkccyyMli2Uay2I93ZgRzQAAB0c\",\"type\":\"WEB\"},\"uuid\":\"faf7398a-4f77-11ea-97fb-5925e98228bd\",\"version\":\"0\"}",
34+
"outcome": "success",
35+
"type": [
36+
"end",
37+
"info"
38+
]
39+
},
40+
"host": {
41+
"name": "trial-xxxxxxx-admin.okta.com"
42+
},
43+
"okta": {
44+
"actor": {
45+
"alternate_id": "username@elastic.co",
46+
"display_name": "xxxxxx",
47+
"id": "00u1abvz4pYqdM8ms4x6",
48+
"type": "User"
49+
},
50+
"authentication_context": {
51+
"authentication_step": 0,
52+
"external_session_id": "102nZHzd6OHSfGG51vsoc22gw"
53+
},
54+
"client": {
55+
"device": "Computer",
56+
"ip": "175.16.199.1",
57+
"user_agent": {
58+
"browser": "FIREFOX",
59+
"os": "Mac OS X",
60+
"raw_user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:72.0) Gecko/20100101 Firefox/72.0"
61+
},
62+
"zone": "null"
63+
},
64+
"debug_context": {
65+
"debug_data": {
66+
"flattened": {
67+
"authnRequestId": "XkcAsWb8WjwDP76xh@1v8wAABp0",
68+
"requestId": "XkccyyMli2Uay2I93ZgRzQAAB0c",
69+
"requestUri": "/login/signout",
70+
"threatSuspected": "false",
71+
"url": "/login/signout?message=login_page_messages.session_has_expired"
72+
},
73+
"request_id": "XkccyyMli2Uay2I93ZgRzQAAB0c",
74+
"request_uri": "/login/signout",
75+
"threat_suspected": "false",
76+
"url": "/login/signout?message=login_page_messages.session_has_expired"
77+
}
78+
},
79+
"display_message": "User logout from Okta",
80+
"event_type": "user.session.end",
81+
"outcome": {
82+
"result": "SUCCESS"
83+
},
84+
"request": {
85+
"ip_chain": [
86+
{
87+
"geographical_context": {
88+
"city": "Dublin",
89+
"country": "United States",
90+
"geolocation": {
91+
"lat": 37.7201,
92+
"lon": -121.919
93+
},
94+
"postal_code": "94568",
95+
"state": "California"
96+
},
97+
"ip": "175.16.199.1",
98+
"version": "V4"
99+
}
100+
]
101+
},
102+
"transaction": {
103+
"id": "XkccyyMli2Uay2I93ZgRzQAAB0c",
104+
"type": "WEB"
105+
},
106+
"uuid": "faf7398a-4f77-11ea-97fb-5925e98228bd"
107+
},
108+
"related": {
109+
"ip": [
110+
"175.16.199.1"
111+
],
112+
"user": [
113+
"xxxxxx",
114+
"username@elastic.co"
115+
]
116+
},
117+
"source": {
118+
"geo": {
119+
"city_name": "Changchun",
120+
"continent_name": "Asia",
121+
"country_iso_code": "CN",
122+
"country_name": "China",
123+
"location": {
124+
"lat": 43.88,
125+
"lon": 125.3228
126+
},
127+
"region_iso_code": "CN-22",
128+
"region_name": "Jilin Sheng"
129+
},
130+
"ip": "175.16.199.1",
131+
"user": {
132+
"full_name": "xxxxxx",
133+
"id": "00u1abvz4pYqdM8ms4x6",
134+
"name": "username@elastic.co"
135+
}
136+
},
137+
"user": {
138+
"full_name": "xxxxxx",
139+
"name": "username@elastic.co"
140+
},
141+
"user_agent": {
142+
"device": {
143+
"name": "Mac"
144+
},
145+
"name": "Firefox",
146+
"original": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:72.0) Gecko/20100101 Firefox/72.0",
147+
"os": {
148+
"full": "Mac OS X 10.15",
149+
"name": "Mac OS X",
150+
"version": "10.15"
151+
},
152+
"version": "72.0"
153+
}
154+
}
155+
]
156+
}

packages/okta/data_stream/system/agent/stream/httpjson.yml.hbs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,11 @@ fields_under_root: true
109109
fields:
110110
_conf:
111111
remove_flattened_debug: {{remove_flattened_debug}}
112-
{{#if processors}}
113112
processors:
113+
{{#if processors}}
114114
{{processors}}
115115
{{/if}}
116+
- add_fields:
117+
target: ''
118+
fields:
119+
okta_url: {{url}}

packages/okta/data_stream/system/elasticsearch/ingest_pipeline/default.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,26 @@ processors:
625625
field: _conf
626626
ignore_missing: true
627627
ignore_failure: true
628+
- uri_parts:
629+
field: okta_url
630+
target_field: okta_url
631+
keep_original: false
632+
ignore_missing: true
633+
- rename:
634+
field: okta_url.domain
635+
target_field: host.name
636+
ignore_missing: true
637+
on_failure:
638+
- rename:
639+
field: okta_url.domain
640+
target_field: okta.okta_domain
641+
on_failure:
642+
- rename:
643+
field: okta_url.domain
644+
target_field: okta_domain
645+
- remove:
646+
field: okta_url
647+
ignore_missing: true
628648
on_failure:
629649
- set:
630650
field: event.kind

packages/okta/data_stream/system/sample_event.json

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"@timestamp": "2020-02-14T20:18:57.718Z",
33
"agent": {
4-
"ephemeral_id": "2314526d-0d90-4c35-ba8f-5a48507e7dac",
5-
"id": "4bff512b-da80-4d11-9e9c-477b723e11d4",
6-
"name": "elastic-agent-20826",
4+
"ephemeral_id": "eeed25bf-dc6f-48ab-b30f-a9c7fa45d6c4",
5+
"id": "f466dfde-d7b7-4c3a-a3e1-9c0175d94132",
6+
"name": "elastic-agent-20611",
77
"type": "filebeat",
8-
"version": "8.17.3"
8+
"version": "8.18.0"
99
},
1010
"client": {
1111
"geo": {
@@ -26,16 +26,16 @@
2626
},
2727
"data_stream": {
2828
"dataset": "okta.system",
29-
"namespace": "54167",
29+
"namespace": "92902",
3030
"type": "logs"
3131
},
3232
"ecs": {
3333
"version": "8.11.0"
3434
},
3535
"elastic_agent": {
36-
"id": "4bff512b-da80-4d11-9e9c-477b723e11d4",
36+
"id": "f466dfde-d7b7-4c3a-a3e1-9c0175d94132",
3737
"snapshot": false,
38-
"version": "8.17.3"
38+
"version": "8.18.0"
3939
},
4040
"event": {
4141
"action": "user.session.start",
@@ -44,10 +44,10 @@
4444
"authentication",
4545
"session"
4646
],
47-
"created": "2025-04-03T02:49:51.730Z",
47+
"created": "2025-04-30T01:38:47.331Z",
4848
"dataset": "okta.system",
4949
"id": "3aeede38-4f67-11ea-abd3-1f5d113f2546",
50-
"ingested": "2025-04-03T02:49:52Z",
50+
"ingested": "2025-04-30T01:38:48Z",
5151
"kind": "event",
5252
"original": "{\"actor\":{\"alternateId\":\"xxxxxx@elastic.co\",\"detailEntry\":null,\"displayName\":\"xxxxxx\",\"id\":\"00u1abvz4pYqdM8ms4x6\",\"type\":\"User\"},\"authenticationContext\":{\"authenticationProvider\":null,\"authenticationStep\":0,\"credentialProvider\":null,\"credentialType\":null,\"externalSessionId\":\"102bZDNFfWaQSyEZQuDgWt-uQ\",\"interface\":null,\"issuer\":null},\"client\":{\"device\":\"Computer\",\"geographicalContext\":{\"city\":\"Dublin\",\"country\":\"United States\",\"geolocation\":{\"lat\":37.7201,\"lon\":-121.919},\"postalCode\":\"94568\",\"state\":\"California\"},\"id\":null,\"ipAddress\":\"108.255.197.247\",\"userAgent\":{\"browser\":\"FIREFOX\",\"os\":\"Mac OS X\",\"rawUserAgent\":\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:72.0) Gecko/20100101 Firefox/72.0\"},\"zone\":\"null\"},\"debugContext\":{\"debugData\":{\"deviceFingerprint\":\"541daf91d15bef64a7e08c946fd9a9d0\",\"requestId\":\"XkcAsWb8WjwDP76xh@1v8wAABp0\",\"requestUri\":\"/api/v1/authn\",\"threatSuspected\":\"false\",\"url\":\"/api/v1/authn?\"}},\"displayMessage\":\"User login to Okta\",\"eventType\":\"user.session.start\",\"legacyEventType\":\"core.user_auth.login_success\",\"outcome\":{\"reason\":null,\"result\":\"SUCCESS\"},\"published\":\"2020-02-14T20:18:57.718Z\",\"request\":{\"ipChain\":[{\"geographicalContext\":{\"city\":\"Dublin\",\"country\":\"United States\",\"geolocation\":{\"lat\":37.7201,\"lon\":-121.919},\"postalCode\":\"94568\",\"state\":\"California\"},\"ip\":\"108.255.197.247\",\"source\":null,\"version\":\"V4\"}]},\"securityContext\":{\"asNumber\":null,\"asOrg\":null,\"domain\":null,\"isProxy\":null,\"isp\":null},\"severity\":\"INFO\",\"target\":null,\"transaction\":{\"detail\":{},\"id\":\"XkcAsWb8WjwDP76xh@1v8wAABp0\",\"type\":\"WEB\"},\"uuid\":\"3aeede38-4f67-11ea-abd3-1f5d113f2546\",\"version\":\"0\"}",
5353
"outcome": "success",
@@ -56,6 +56,9 @@
5656
"info"
5757
]
5858
},
59+
"host": {
60+
"name": "svc-okta-oauth2"
61+
},
5962
"input": {
6063
"type": "httpjson"
6164
},

packages/okta/docs/README.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ An example event for `system` looks as following:
5858
{
5959
"@timestamp": "2020-02-14T20:18:57.718Z",
6060
"agent": {
61-
"ephemeral_id": "2314526d-0d90-4c35-ba8f-5a48507e7dac",
62-
"id": "4bff512b-da80-4d11-9e9c-477b723e11d4",
63-
"name": "elastic-agent-20826",
61+
"ephemeral_id": "eeed25bf-dc6f-48ab-b30f-a9c7fa45d6c4",
62+
"id": "f466dfde-d7b7-4c3a-a3e1-9c0175d94132",
63+
"name": "elastic-agent-20611",
6464
"type": "filebeat",
65-
"version": "8.17.3"
65+
"version": "8.18.0"
6666
},
6767
"client": {
6868
"geo": {
@@ -83,16 +83,16 @@ An example event for `system` looks as following:
8383
},
8484
"data_stream": {
8585
"dataset": "okta.system",
86-
"namespace": "54167",
86+
"namespace": "92902",
8787
"type": "logs"
8888
},
8989
"ecs": {
9090
"version": "8.11.0"
9191
},
9292
"elastic_agent": {
93-
"id": "4bff512b-da80-4d11-9e9c-477b723e11d4",
93+
"id": "f466dfde-d7b7-4c3a-a3e1-9c0175d94132",
9494
"snapshot": false,
95-
"version": "8.17.3"
95+
"version": "8.18.0"
9696
},
9797
"event": {
9898
"action": "user.session.start",
@@ -101,10 +101,10 @@ An example event for `system` looks as following:
101101
"authentication",
102102
"session"
103103
],
104-
"created": "2025-04-03T02:49:51.730Z",
104+
"created": "2025-04-30T01:38:47.331Z",
105105
"dataset": "okta.system",
106106
"id": "3aeede38-4f67-11ea-abd3-1f5d113f2546",
107-
"ingested": "2025-04-03T02:49:52Z",
107+
"ingested": "2025-04-30T01:38:48Z",
108108
"kind": "event",
109109
"original": "{\"actor\":{\"alternateId\":\"xxxxxx@elastic.co\",\"detailEntry\":null,\"displayName\":\"xxxxxx\",\"id\":\"00u1abvz4pYqdM8ms4x6\",\"type\":\"User\"},\"authenticationContext\":{\"authenticationProvider\":null,\"authenticationStep\":0,\"credentialProvider\":null,\"credentialType\":null,\"externalSessionId\":\"102bZDNFfWaQSyEZQuDgWt-uQ\",\"interface\":null,\"issuer\":null},\"client\":{\"device\":\"Computer\",\"geographicalContext\":{\"city\":\"Dublin\",\"country\":\"United States\",\"geolocation\":{\"lat\":37.7201,\"lon\":-121.919},\"postalCode\":\"94568\",\"state\":\"California\"},\"id\":null,\"ipAddress\":\"108.255.197.247\",\"userAgent\":{\"browser\":\"FIREFOX\",\"os\":\"Mac OS X\",\"rawUserAgent\":\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:72.0) Gecko/20100101 Firefox/72.0\"},\"zone\":\"null\"},\"debugContext\":{\"debugData\":{\"deviceFingerprint\":\"541daf91d15bef64a7e08c946fd9a9d0\",\"requestId\":\"XkcAsWb8WjwDP76xh@1v8wAABp0\",\"requestUri\":\"/api/v1/authn\",\"threatSuspected\":\"false\",\"url\":\"/api/v1/authn?\"}},\"displayMessage\":\"User login to Okta\",\"eventType\":\"user.session.start\",\"legacyEventType\":\"core.user_auth.login_success\",\"outcome\":{\"reason\":null,\"result\":\"SUCCESS\"},\"published\":\"2020-02-14T20:18:57.718Z\",\"request\":{\"ipChain\":[{\"geographicalContext\":{\"city\":\"Dublin\",\"country\":\"United States\",\"geolocation\":{\"lat\":37.7201,\"lon\":-121.919},\"postalCode\":\"94568\",\"state\":\"California\"},\"ip\":\"108.255.197.247\",\"source\":null,\"version\":\"V4\"}]},\"securityContext\":{\"asNumber\":null,\"asOrg\":null,\"domain\":null,\"isProxy\":null,\"isp\":null},\"severity\":\"INFO\",\"target\":null,\"transaction\":{\"detail\":{},\"id\":\"XkcAsWb8WjwDP76xh@1v8wAABp0\",\"type\":\"WEB\"},\"uuid\":\"3aeede38-4f67-11ea-abd3-1f5d113f2546\",\"version\":\"0\"}",
110110
"outcome": "success",
@@ -113,6 +113,9 @@ An example event for `system` looks as following:
113113
"info"
114114
]
115115
},
116+
"host": {
117+
"name": "svc-okta-oauth2"
118+
},
116119
"input": {
117120
"type": "httpjson"
118121
},

packages/okta/manifest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: okta
22
title: Okta
3-
version: "3.6.0"
3+
version: "3.7.0"
44
description: Collect and parse event logs from Okta API with Elastic Agent.
55
type: integration
66
format_version: "3.2.3"

0 commit comments

Comments
 (0)