You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: app/gateway/audit-logs.md
+111-4
Original file line number
Diff line number
Diff line change
@@ -6,8 +6,12 @@ layout: reference
6
6
products:
7
7
- gateway
8
8
9
+
tags:
10
+
- logging
11
+
- audit-logging
12
+
9
13
min_version:
10
-
gateway: '3.5'
14
+
gateway: '3.4'
11
15
12
16
description: placeholder
13
17
@@ -18,10 +22,113 @@ related_resources:
18
22
url: /gateway/logs/
19
23
- text: "{{site.base_gateway}} debugging"
20
24
url: /gateway/debug/
25
+
- text: "{{site.konnect_short_name}} audit logs"
26
+
url: /audit-logs/
21
27
---
22
28
23
-
@todo
29
+
You can generate {{site.base_gateway}} audit logs using the Admin API and the data is written to {{site.base_gateway}}'s database. Audit logs provide details about HTTP requests handled by the Admin API as well as database changes. This allows cluster administrators to keep track of changes made to the cluster configuration throughout its lifetime, aiding in compliance efforts and providing valuable data points during forensic investigations.
30
+
31
+
Because every audit log entry is made available via {{site.base_gateway}}’s Admin API, you can send audit log entries into existing logging warehouses, SIEM solutions, or other remote services for duplication and inspection.
32
+
33
+
## What type of events are included in audit logs?
34
+
35
+
{{site.base_gateway}} includes details about the following in audit logs:
|[RBAC](/gateway/entities/rbac/)|`rbac_user_id`<br>`rbac_user_name`|[`/audit/requests`](/api/gateway/admin-ee/#/operations/get-audit-requests)| When RBAC is enforced, the RBAC user’s UUID will be written to the `rbac_user_id` field in the audit log entry, and the username will be written to the `rbac_user_name` field. |
40
+
|[Workspace](/gateway/entities/workspace/)|`workspace`|[`/audit/requests`](/api/gateway/admin-ee/#/operations/get-audit-requests)| The `workspace` field is the UUID of the Workspace with which the request is associated. |
41
+
|[Kong Manager login](/gateway/kong-manager/)|`"request_source": "kong-manager"`<br>`"method": "GET", "path": "/auth"`|[`/audit/requests`](/api/gateway/admin-ee/#/operations/get-audit-requests)| The `request_source` field tells you that the action occurred in Kong Manager, and the `GET` method and `/auth` path indicate a login event. |
42
+
|[Kong Manager logout](/gateway/kong-manager/)|`"request_source": "kong-manager"`<br>`"method": "DELETE", "path": "/auth?session_logout=true"`|[`/audit/requests`](/api/gateway/admin-ee/#/operations/get-audit-requests)| The `DELETE` method and `/auth?session_logout=true` path indicate a logout event. |
43
+
| Database entity changes |`payload` (contains changed objects)<br>`request_id`|[`/audit/objects`](/api/gateway/admin-ee/#/operations/get-audit-objects)| Entries for all insertions, updates, and deletions to the cluster database. Database update audit logs are also associated with Admin API request unique IDs. Object audit entries contain information about the entity updated, including the entity body itself, its database primary key, and the type of operation performed (create, update, or delete). It's also associated with the `request_id` field. |
44
+
45
+
## Enable audit logging
46
+
47
+
Audit logging is disabled by default. Configure it with the [`audit_log`](/gateway/configuration/#audit_log) {{site.base_gateway}} configuration in `kong.conf`:
48
+
49
+
```bash
50
+
audit_log = on
51
+
```
52
+
53
+
Or via environment variables:
54
+
55
+
```bash
56
+
export KONG_AUDIT_LOG=on
57
+
```
58
+
59
+
As with other Kong configurations, changes take effect on [`kong reload`](/how-to/restart-kong-gateway-container/) or `kong restart`.
60
+
61
+
## Disable audit logging for certain methods, paths, or database entities
62
+
63
+
You may want to ignore audit log generation for certain Admin API
64
+
requests, such as requests to the `/status` endpoint for
65
+
health checking, or to ignore requests to a specific path prefix, for example, a given Workspace.
66
+
67
+
Use the [`audit_log_ignore_methods`](/gateway/configuration/#audit_log_ignore_methods) and
{{site.base_gateway}} configuration property. Records in the database older than the seconds configured in `audit_log_record_ttl` are automatically purged.
120
+
121
+
PostgreSQL purges records via the stored procedure that is executed on insert into the
122
+
record database.
123
+
Therefore, request audit records may exist in the database longer than the configured TTL
124
+
if no new records are inserted to the audit table following the expiration timestamp.
125
+
126
+
## Sign audit logs with a private RSA key
127
+
128
+
To provide non-repudiation, audit logs may be signed with a private RSA key by using [`audit_log_signing_key`](/gateway/configuration/#audit_log_signing_key). When
129
+
enabled, a lexically sorted representation of each audit log entry is signed by
130
+
the defined private key; the signature is stored in an additional field within
131
+
the record itself. The public key should be stored elsewhere and can be used
132
+
later to validate the signature of the record. For more information, see [Sign {{site.base_gateway}} audit logs with an RSA key](/how-to/sign-gateway-audit-logs/).
24
133
25
-
Pull content from https://docs.konghq.com/gateway/latest/kong-enterprise/audit-log/
26
134
27
-
Be sure to add card for this to Gateway Security landing page
0 commit comments