Skip to content

Commit fd69cbe

Browse files
authored
Merge pull request #3372 from aleksandrychev/auditlogs
ENT-11977: Updated Audit log API documentation
2 parents 3d15069 + 740b5ce commit fd69cbe

File tree

1 file changed

+83
-21
lines changed

1 file changed

+83
-21
lines changed

api/enterprise-api-ref/audit-logs-api.markdown

Lines changed: 83 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
---
22
layout: default
3-
title: Audit logs API
3+
title: Audit log API
44
published: true
55
---
66

7-
Audit logs API provides access to system audit logs that track user actions across the platform made to critical parts
7+
Audit log API provides access to system audit logs that track user actions across the platform made to critical parts
88
such as settings, host data, users, roles, Build projects, etc.
99

1010
## Get audit logs
1111

12-
**URI:** https://hub.cfengine.com/api/audit-logs
12+
**URI:** https://hub.cfengine.com/api/audit-log
1313

1414
**Method:** GET
1515

@@ -18,9 +18,11 @@ such as settings, host data, users, roles, Build projects, etc.
1818
* **actor** *(string)*
1919
Filter by user who performed the action.
2020
* **object_type** *(string)*
21-
Filter by object type (see [Allowed object types][Audit logs API#Allowed object types]).
21+
Filter by object type (see [Allowed object types][Audit log API#Allowed object types]).
2222
* **action** *(string)*
23-
Filter by action type (see [Allowed actions][Audit logs API#Allowed actions]).
23+
Filter by action type (see [Allowed actions][Audit log API#Allowed actions]).
24+
* **object_name** *(integer)*
25+
Filter by object name.
2426
* **created_after** *(integer)*
2527
Unix timestamp to filter logs after this time.
2628
* **created_before** *(integer)*
@@ -35,6 +37,7 @@ such as settings, host data, users, roles, Build projects, etc.
3537
* actor
3638
* action
3739
* object_id
40+
* object_name
3841
* object_type
3942
* **sort_direction** *(string, default: "DESC")*
4043
Sort direction. Allowed values:
@@ -44,7 +47,7 @@ such as settings, host data, users, roles, Build projects, etc.
4447
**Example request (curl):**
4548

4649
```console
47-
curl --user <username>:<password> -X GET https://hub.cfengine.com/api/audit-logs
50+
curl --user <username>:<password> -X GET https://hub.cfengine.com/api/audit-log
4851
```
4952

5053
**Successful response example:**
@@ -59,6 +62,7 @@ HTTP 200 OK
5962
"actor": "admin",
6063
"action": "created",
6164
"object_type": "user",
65+
"object_name": "test",
6266
"object_id": "test",
6367
"details": [
6468
"Created user `test`."
@@ -69,6 +73,7 @@ HTTP 200 OK
6973
"time": "2024-10-24 09:46:56.204391",
7074
"actor": "admin",
7175
"action": "created",
76+
"object_name": "test",
7277
"object_type": "role",
7378
"object_id": "test",
7479
"details": [
@@ -86,6 +91,7 @@ HTTP 200 OK
8691
"actor": "admin",
8792
"action": "updated",
8893
"object_type": "settings",
94+
"object_name": "Preferences",
8995
"object_id": null,
9096
"details": [
9197
"Settings updated.",
@@ -121,15 +127,15 @@ HTTP 200 OK
121127

122128
| Action | Description |
123129
|----------------------|---------------------------|
124-
| created | Resource creation |
125-
| updated | Resource update |
126-
| deleted | Resource deletion |
127-
| deployed | Deployment action |
128-
| pushed | Push action |
129-
| module added | Module addition |
130-
| module deleted | Module removal |
131-
| module updated | Module modification |
132-
| module input updated | Module input modification |
130+
| Created | Resource creation |
131+
| Updated | Resource update |
132+
| Deleted | Resource deletion |
133+
| Deployed | Deployment action |
134+
| Pushed | Push action |
135+
| Module added | Module addition |
136+
| Module deleted | Module removal |
137+
| Module updated | Module modification |
138+
| Module input updated | Module input modification |
133139
| CMDB updated | CMDB update |
134140
| CMDB deleted | CMDB deletion |
135141
| CMDB created | CMDB creation |
@@ -139,10 +145,66 @@ HTTP 200 OK
139145

140146
| Object Type | Description |
141147
|---------------------|----------------------------------------------|
142-
| user | User account |
143-
| role | Role definition |
144-
| settings | System, Mail, VCS or Authentication settings |
145-
| federated reporting | Federated reporting configuration |
146-
| group | Host groups |
147-
| host | Host configuration |
148+
| User | User account |
149+
| Role | Role definition |
150+
| Settings | System, Mail, VCS or Authentication settings |
151+
| Federated reporting | Federated reporting configuration |
152+
| Group | Host groups |
153+
| Host | Host configuration |
148154
| Build project | Build project configuration |
155+
156+
157+
## Get audit logs actors
158+
159+
Returns list of users who performed actions.
160+
161+
**URI:** https://hub.cfengine.com/api/audit-log/actors
162+
163+
**Method:** GET
164+
165+
**Example request (curl):**
166+
167+
```console
168+
curl --user <username>:<password> -X GET https://hub.cfengine.com/api/audit-log/actors
169+
```
170+
171+
**Successful response example:**
172+
173+
```
174+
HTTP 200 OK
175+
[
176+
"admin",
177+
"test"
178+
]
179+
```
180+
181+
## Get audit logs object name by type
182+
183+
Returns list of object names filtered by type.
184+
185+
**URI:** https://hub.cfengine.com/api/audit-log/:type/names
186+
187+
**Method:** GET
188+
189+
**Parameters:**
190+
191+
* **object_type** *(string)*
192+
Filter by object type (see [Allowed object types][Audit log API#Allowed object types]).
193+
194+
**Example request (curl):**
195+
196+
```console
197+
curl --user <username>:<password> -X GET https://hub.cfengine.com/api/audit-log/Settings/names
198+
```
199+
200+
**Successful response example:**
201+
202+
```
203+
HTTP 200 OK
204+
[
205+
"Preferences",
206+
"Mail",
207+
"VCS",
208+
"Authentication",
209+
]
210+
```

0 commit comments

Comments
 (0)