Skip to content

Commit 90a5699

Browse files
committed
Audit Logs
1 parent 55d0a61 commit 90a5699

File tree

6 files changed

+237
-5
lines changed

6 files changed

+237
-5
lines changed

src/content/docs/fundamentals/account/account-security/abuse-contact.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
22
pcx_content_type: how-to
33
title: Add abuse contact
4-
4+
sidebar:
5+
order: 1
56
---
67

78
Enter an abuse contact email address to ensure you are receiving communications regarding potential abuse on your websites.
Lines changed: 222 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,222 @@
1+
---
2+
pcx_content_type: reference
3+
title: Audit Logs - version 2 (beta)
4+
sidebar:
5+
order: 6
6+
label: Audit Logs - v2
7+
badge:
8+
text: Beta
9+
10+
---
11+
12+
import { APIRequest } from "~/components"
13+
14+
Cloudflare Audit Logs are account-based. All user-initiated actions are recorded automatically across the API and Dashboard. The system-initiated actions are logged along with additional information and enrichments to user-initiated actions. When an action occurs, it is streamed through Cloudflare's audit logging pipeline and stored. This ensures consistent visibility into activity across all products.
15+
16+
For more detailed information about how the user-initiated actions are logged automatically, refer to the [Cloudflare Blog](https://blog.cloudflare.com/introducing-automatic-audit-logs/).
17+
18+
:::note
19+
A transition plan from Audit Logs v1 to Audit Logs v2 will be communicated in due course.
20+
:::
21+
22+
## Key features
23+
24+
Audit Logs (version 2) provide a unified and standardized system for tracking and recording actions across Cloudflare products. This system enhances transparency and accountability by offering comprehensive insights into user-initiated and system-initiated activities within your Cloudflare environment.
25+
26+
- **Standardized logging**: Audit logs are automatically generated in a consistent format across all Cloudflare services, ensuring uniformity and eliminating inconsistencies.
27+
- **Expanded product coverage**: Audit Logs covers 111 products, capturing actions from key endpoints, such as `/accounts`, `/zones`, `/user`, and `/memberships` APIs.
28+
- **Granular filtering**: Uniformly formatted logs allow for precise filtering by actions, actors, methods, and resources, facilitating efficient investigations.
29+
- **Enhanced context and transparency**: Each log entry includes detailed context, such as the authentication method used, the interface (API or Dashboard) through which the action was performed, and mappings to Cloudflare Ray IDs for improved traceability.
30+
- **Comprehensive activity capture**: Beyond create, edit, and delete actions, Audit Logs records GET requests and failed attempts, ensuring no critical activity is overlooked.
31+
32+
## Retention
33+
34+
Audit Logs are retained for 18 months before being deleted. Enterprise customers can use [Logpush](/logs/logpush/) to store Audit Logs for longer periods of time. Logpush for Audit Logs v2 will be available for GA.
35+
36+
## Access Audit Logs
37+
38+
You can retrieve audit logs using one of the API or the dashboard. Audit Logs v2 will soon be available with Logpush.
39+
40+
### API
41+
42+
Audit Logs are available through the Cloudflare API. To retrieve audit logs, use the following endpoint:
43+
44+
```bash
45+
https://api.cloudflare.com/client/v4/accounts/{account_id}/logs/audit
46+
```
47+
48+
Below is an example request to retrieve audit logs for a certain period of time along with its corresponding response. Replace the example values in the URL with your actual values:
49+
50+
- `account_id`: Your Cloudflare account identifier.
51+
- `Since` (required): Start date for the audit log retrieval in the format yyyy-mm-dd.​
52+
- `Before` (required) : End date for the audit log retrieval in the format yyyy-mm-dd.
53+
54+
```bash
55+
GET https://api.cloudflare.com/client/v4/accounts/1234567890abcdef/logs/audit?since=2025-03-01T00:00:00Z&before=2025-03-26T23:59:59Z
56+
```
57+
58+
```json title="Example response"
59+
{
60+
"result": [
61+
{
62+
"action": "zone.settings.change",
63+
"actor": {
64+
"email": "[email protected]",
65+
"id": "0987654321abcdef"
66+
},
67+
"ip": "192.0.2.1",
68+
"method": "PUT",
69+
"interface": "dashboard",
70+
"resources": [
71+
{
72+
"resource_id": "zone123",
73+
"resource_type": "zone"
74+
}
75+
],
76+
"timestamp": "2025-03-15T14:25:37Z"
77+
}
78+
// Additional log entries
79+
],
80+
"success": true,
81+
"errors": [],
82+
"messages": []
83+
}
84+
```
85+
86+
For more information refer to the [API documentation](https://developers.cloudflare.com/api/resources/accounts/subresources/logs/subresources/audit/methods/list/#(params)%20default%20%3E%20(param)%20since%20%3E%20(schema)).
87+
88+
### Dashboard
89+
90+
To access audit logs in the Cloudflare dashboard:
91+
92+
1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/login) and select your account.
93+
2. Go to **Manage Account** > **Audit Log**.
94+
95+
:::note
96+
The Audit Logs v1 UI is shown by default, and users can switch between Audit Logs v1 and v2 as needed.
97+
:::
98+
99+
## Audit Log structure
100+
101+
Cloudflare's audit logs offer a detailed view of activity across your environment by capturing both the source of actions and the context in which they occur. These logs are categorized by who initiated the action (user or system) and whether the activity occurred within a specific account or spanned multiple accounts under the same user profile. This structure enables flexible filtering, investigation, and compliance monitoring.
102+
103+
### Initiation type
104+
105+
Audit logs can be initiated either by users or the system. Understanding the type of actor involved helps in identifying the source and intent of actions.
106+
107+
#### User initiated Audit Logs
108+
109+
Track actions performed directly by users through Cloudflare interfaces (Dashboard or API). These logs capture who performed the action, when it occurred, and what resource was affected. User initiated actions can be performed by three actors:
110+
111+
- `actor_type="user"`: Action was performed by an individual user.
112+
- `actor_type="Cloudflare_admin"`: Action was performed by Cloudflare.
113+
- `actor_type="account"`: Action was performed using an account owned token. Refer to the [Account owned tokens](/fundamentals/api/get-started/account-owned-tokens/) documentation for more information.
114+
115+
#### System initiated Audit Logs
116+
117+
Record changes made automatically by Cloudflare systems, without direct user input. These logs provide visibility into internal processes, automated tasks, and security events. Some entries may include associated user context for traceability (`actor_type="system"`).
118+
119+
### Activity Scope
120+
121+
#### Account Activity Logs
122+
123+
Contain events scoped to a single Cloudflare account. These logs are filterable by `account ID` and reflect actions within that account only. You can optionally filter events further using the resource_scope field, which specifies whether the resource is associated with a user, an account, or a zone (`resource_scope ="user"`, `resource_scope ="accounts"`, or `resource_scope ="zones"`).
124+
125+
#### User Profile Activity Logs
126+
127+
Reflect actions associated with a user's login (email) across multiple accounts. These logs enable cross-account tracking and can be filtered by `user ID` or `email`. They are visible on any account the user had access to at the time of the activity. User Profile Activity Logs can be filtered using `resource_scope ="user"`.
128+
129+
:::note
130+
The `GET /memberships` endpoint supports cross-account access.
131+
:::
132+
133+
## Example how to query Audit Logs
134+
135+
Use the following example to get a list of audit logs for a user account.
136+
137+
<APIRequest
138+
method="GET"
139+
path="/accounts/{account_id}/logs/audit"
140+
/>
141+
142+
```json title="Example response"
143+
{
144+
"errors": [
145+
{
146+
"message": "message"
147+
}
148+
],
149+
"result": [
150+
{
151+
"account": {
152+
"id": "4bb334f7c94c4a29a045f03944f072e5",
153+
"name": "Example Account"
154+
},
155+
"action": {
156+
"description": "Add Member",
157+
"result": "success",
158+
"time": "2024-04-26T17:31:07Z",
159+
"type": "create"
160+
},
161+
"actor": {
162+
"id": "f6b5de0326bb5182b8a4840ee01ec774",
163+
"context": "dash",
164+
"email": "[email protected]",
165+
"ip_address": "198.41.129.166",
166+
"token_id": "token_id",
167+
"token_name": "token_name",
168+
"type": "user"
169+
},
170+
"raw": {
171+
"cf_ray_id": "8e9b1c60ef9e1c9a",
172+
"method": "POST",
173+
"status_code": 200,
174+
"uri": "/accounts/4bb334f7c94c4a29a045f03944f072e5/members",
175+
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Safari/605.1.15"
176+
},
177+
"resource": {
178+
"id": "id",
179+
"product": "members",
180+
"request": {},
181+
"response": {},
182+
"scope": {},
183+
"type": "type"
184+
},
185+
"zone": {
186+
"id": "id",
187+
"name": "example.com"
188+
}
189+
}
190+
],
191+
"result_info": {
192+
"count": "1",
193+
"cursor": "ASqdKd7dKgxh-aZ8bm0mZos1BtW4BdEqifCzNkEeGRzi_5SN_-362Y8sF-C1TRn60_6rd3z2dIajf9EAPyQ_NmIeAMkacmaJPXipqvP7PLU4t72wyqBeJfjmjdE="
194+
},
195+
"success": true
196+
}
197+
```
198+
199+
## Common terms and definitions
200+
201+
### Actor
202+
203+
The actor represents who performed the action. It includes identity attributes like user ID, email address, IP address, and the type of actor (`user`, `account`, `Cloudflare_admin`, or `system`). It also includes the context used to initiate the action, such as API or Dashboard (`dash`).
204+
205+
### Action
206+
207+
The action field captures the nature of the event and whether it was successful. It includes a high-level type (e.g., `view`, `create`, `update`, `delete`), a specific description (such as `SSO_LOGIN`), the timestamp of when the action occurred, and the result (`success` or `failure`).
208+
All `GET` requests are captured as `view` actions in Audit Logs.
209+
210+
### Account
211+
212+
This field refers to the Cloudflare account under which the action was executed. It includes a unique account ID and a human-readable account name to help associate activity with a customer environment.
213+
214+
### Resource
215+
216+
The resource identifoes the object impacted by the action. It includes the resource type, the unique resource ID, the scope (`user`, `account`, or `zone`), and optionally the product associated with the change.
217+
218+
### Audit Log ID
219+
220+
This is a unique identifier for the log record itself. It can be used for deduplication, correlation, or referencing specific actions during investigations.
221+
222+

src/content/docs/fundamentals/account/account-security/cloudflare-access.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ title: Allow Cloudflare access
44
head:
55
- tag: title
66
content: Provide edit access to Cloudflare Support
7-
7+
sidebar:
8+
order: 2
89
---
910

1011
Occasionally, you may want to allow edit access to your account for Cloudflare Support. A typical use case might be migrating a complex or sensitive domain over to Cloudflare.

src/content/docs/fundamentals/account/account-security/leaked-password-notifications.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
pcx_content_type: reference
33
title: Leaked Password Notifications
4+
sidebar:
5+
order: 3
46

57
---
68

src/content/docs/fundamentals/account/account-security/manage-active-sessions.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
22
title: Manage active sessions
33
pcx_content_type: how-to
4-
4+
sidebar:
5+
order: 4
56
---
67

78
import { Render } from "~/components"

src/content/docs/fundamentals/account/account-security/review-audit-logs.mdx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
---
2-
title: Review audit logs
2+
title: Review audit logs - v1
33
pcx_content_type: how-to
4-
4+
sidebar:
5+
order: 5
56
---
67

78
import { Render } from "~/components"
89

10+
:::note
11+
Audit Logs version 2 is available in beta. Refer to the [Audit Logs v2 documentation](/fundamentals/account/account-security/audit-logs/) for more details.
12+
:::
13+
914
<Render file="account-audit-logs-definition" />
1015

1116
## Access audit logs

0 commit comments

Comments
 (0)