|
| 1 | +# Audit |
| 2 | + |
| 3 | +> This page is incomplete, stay tuned. |
| 4 | +
|
| 5 | +## Get audit logs |
| 6 | + |
| 7 | +### Code samples |
| 8 | + |
| 9 | +```shell |
| 10 | +# Example request using curl |
| 11 | +curl -X GET http://coder-server:8080/api/v2/audit?q=string \ |
| 12 | + -H 'Accept: application/json' \ |
| 13 | + -H 'Coder-Session-Token: API_KEY' |
| 14 | +``` |
| 15 | + |
| 16 | +`GET /audit` |
| 17 | + |
| 18 | +### Parameters |
| 19 | + |
| 20 | +| Name | In | Type | Required | Description | |
| 21 | +| ---------- | ----- | ------------ | -------- | ------------ | |
| 22 | +| `q` | query | string | true | Search query | |
| 23 | +| `after_id` | query | string(uuid) | false | After ID | |
| 24 | +| `limit` | query | integer | false | Page limit | |
| 25 | +| `offset` | query | integer | false | Page offset | |
| 26 | + |
| 27 | +### Example responses |
| 28 | + |
| 29 | +> 200 Response |
| 30 | +
|
| 31 | +```json |
| 32 | +{ |
| 33 | + "audit_logs": [ |
| 34 | + { |
| 35 | + "action": "string", |
| 36 | + "additional_fields": [0], |
| 37 | + "description": "string", |
| 38 | + "diff": { |
| 39 | + "property1": { |
| 40 | + "new": null, |
| 41 | + "old": null, |
| 42 | + "secret": true |
| 43 | + }, |
| 44 | + "property2": { |
| 45 | + "new": null, |
| 46 | + "old": null, |
| 47 | + "secret": true |
| 48 | + } |
| 49 | + }, |
| 50 | + "id": "string", |
| 51 | + "ip": {}, |
| 52 | + "is_deleted": true, |
| 53 | + "organization_id": "string", |
| 54 | + "request_id": "string", |
| 55 | + "resource_icon": "string", |
| 56 | + "resource_id": "string", |
| 57 | + "resource_link": "string", |
| 58 | + "resource_target": "string", |
| 59 | + "resource_type": "string", |
| 60 | + "status_code": 0, |
| 61 | + "time": "string", |
| 62 | + "user": { |
| 63 | + "avatar_url": "string", |
| 64 | + "created_at": "string", |
| 65 | + "email": "string", |
| 66 | + "id": "string", |
| 67 | + "last_seen_at": "string", |
| 68 | + "organization_ids": ["string"], |
| 69 | + "roles": [ |
| 70 | + { |
| 71 | + "display_name": "string", |
| 72 | + "name": "string" |
| 73 | + } |
| 74 | + ], |
| 75 | + "status": "string", |
| 76 | + "username": "string" |
| 77 | + }, |
| 78 | + "user_agent": "string" |
| 79 | + } |
| 80 | + ], |
| 81 | + "count": 0 |
| 82 | +} |
| 83 | +``` |
| 84 | + |
| 85 | +### Responses |
| 86 | + |
| 87 | +| Status | Meaning | Description | Schema | |
| 88 | +| ------ | ------------------------------------------------------- | ----------- | ---------------------------------------------------------------- | |
| 89 | +| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.AuditLogResponse](schemas.md#codersdkauditlogresponse) | |
| 90 | + |
| 91 | +To perform this operation, you must be authenticated by means of one of the following methods: **CoderSessionToken**. |
| 92 | + |
| 93 | +## Generate fake audit log |
| 94 | + |
| 95 | +### Code samples |
| 96 | + |
| 97 | +```shell |
| 98 | +# Example request using curl |
| 99 | +curl -X POST http://coder-server:8080/api/v2/audit/testgenerate \ |
| 100 | + -H 'Content-Type: application/json' \ |
| 101 | + -H 'Coder-Session-Token: API_KEY' |
| 102 | +``` |
| 103 | + |
| 104 | +`POST /audit/testgenerate` |
| 105 | + |
| 106 | +> Body parameter |
| 107 | +
|
| 108 | +```json |
| 109 | +{ |
| 110 | + "action": "string", |
| 111 | + "resource_id": "string", |
| 112 | + "resource_type": "string", |
| 113 | + "time": "string" |
| 114 | +} |
| 115 | +``` |
| 116 | + |
| 117 | +### Parameters |
| 118 | + |
| 119 | +| Name | In | Type | Required | Description | |
| 120 | +| ------ | ---- | ---------------------------------------------------------------------------------- | -------- | ----------------- | |
| 121 | +| `body` | body | [codersdk.CreateTestAuditLogRequest](schemas.md#codersdkcreatetestauditlogrequest) | true | Audit log request | |
| 122 | + |
| 123 | +### Responses |
| 124 | + |
| 125 | +| Status | Meaning | Description | Schema | |
| 126 | +| ------ | --------------------------------------------------------------- | ----------- | ------ | |
| 127 | +| 204 | [No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5) | No Content | | |
| 128 | + |
| 129 | +To perform this operation, you must be authenticated by means of one of the following methods: **CoderSessionToken**. |
0 commit comments