- Log
association_changeDI Events from within Directory - Get these events to look as similar to the events currently logged in SI
- How do I get similar metadata to what SI currently logs?
- How do I want to format the core event data?
- Is there a meaningful distinction between generic event metadata and the core event schema?
- Between something like
providerthat can potentially be on every event, and something likeassociationthat will only be present onassociation_changeevents. - It sounds like the RequestMetaData is correct place for the generic stuff.
- Does it make sense to have separate structs for specific event schemas?
- Between something like
- Does this RequestMetaData mechanism allow the data to get as far as it needs to get?
- The data must make it from
WebUI->directory.Graph (directory-api)->SQS->directory-worker
- The data must make it from
This is a pseudocode example of the 'specific event schema' referred to above. This data doesn't really make sense to bake into the RequestMetaData as it's not metadata on the request, it's the actual event itself. How do we encapsulate this?
- Can have this be a dedicated schema (as below)
- We can just fill out a generic map of
map[String]interface{}and pass that to the event logger- This feels prone to misuse/mistakes
struct AssociationChangeEvent {
Op String
ActionSource String
Attributes map[String]interface{}
Connection Connection
}
struct Connection {
From GraphEntity
To GraphEntity
}
Existing Event as logged from SI:
- The end goal is to capture as similar event as possible as what SI is logging
{
"initiated_by": {
"id": "62b0d5bdb90dc69e9739bf89",
"type": "admin",
"email": "[email protected]"
},
"geoip": {},
"useragent": {
"patch": "0",
"os_full": "Linux",
"major": "106",
"minor": "0",
"os": "Linux",
"name": "Chrome",
"os_name": "Linux",
"device": "Other",
"version": "106.0.0.0"
},
"association": {
"op": "add",
"action_source": "manual",
"attributes": null,
"connection": {
"from": {
"name": "ExemptionsGroup",
"type": "user_group",
"object_id": "630fb4f5d30dc2000132abae"
},
"to": {
"name": "user-2",
"type": "user",
"object_id": "62b22397839f664293876809"
}
}
},
"auth_method": "session",
"@timestamp": "2022-09-29T21:27:41.994Z",
"event_type": "association_change",
"provider": null,
"service": "directory",
"file_input_timestamp": "2022-09-29T21:27:41.892Z",
"success": true,
"organization": "62b0d5bdb90dc63ffb39bf8b",
"@version": "1",
"client_ip": "172.24.0.1",
"id": "63360dcd9bf548b867c7eef5",
"timestamp": "2022-09-29T21:27:41.308Z"
}
.
.
.
.
EventUtils.logEvent(reqCtx, common.AssociationChangeEvent{ ...... });
``