summaryrefslogtreecommitdiff
path: root/doc/development/audit_event_guide
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-04-08 15:10:26 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-04-08 15:10:26 +0000
commit9f9dc2bc412632e6b459d0bb9e1ac205c8cf34af (patch)
treecaafa909017726a087ae4e4bdaeb558ac2c04a9b /doc/development/audit_event_guide
parent88bacc889f129f8d95af34f1781dd66769ec27cc (diff)
downloadgitlab-ce-9f9dc2bc412632e6b459d0bb9e1ac205c8cf34af.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'doc/development/audit_event_guide')
-rw-r--r--doc/development/audit_event_guide/index.md18
1 files changed, 10 insertions, 8 deletions
diff --git a/doc/development/audit_event_guide/index.md b/doc/development/audit_event_guide/index.md
index ca573262f04..34f78174e5b 100644
--- a/doc/development/audit_event_guide/index.md
+++ b/doc/development/audit_event_guide/index.md
@@ -18,13 +18,14 @@ actions performed across the application.
To instrument an audit event, the following attributes should be provided:
-| Attribute | Type | Required? | Description |
-|:-------------|:---------------------|:----------|:----------------------------------------------------|
-| `name` | String | false | Action name to be audited. Used for error tracking |
-| `author` | User | true | User who authors the change |
-| `scope` | User, Project, Group | true | Scope which the audit event belongs to |
-| `target` | Object | true | Target object being audited |
-| `message` | String | true | Message describing the action |
+| Attribute | Type | Required? | Description |
+|:-------------|:---------------------|:----------|:-----------------------------------------------------------------|
+| `name` | String | false | Action name to be audited. Used for error tracking |
+| `author` | User | true | User who authors the change |
+| `scope` | User, Project, Group | true | Scope which the audit event belongs to |
+| `target` | Object | true | Target object being audited |
+| `message` | String | true | Message describing the action |
+| `created_at` | DateTime | false | The time when the action occured. Defaults to `DateTime.current` |
## How to instrument new Audit Events
@@ -97,7 +98,8 @@ if merge_approval_rule.save
author: current_user,
scope: project_alpha,
target: merge_approval_rule,
- message: 'Created a new approval rule'
+ message: 'Created a new approval rule',
+ created_at: DateTime.current # Useful for pre-dating an audit event when created asynchronously.
}
::Gitlab::Audit::Auditor.audit(audit_context)