-
Notifications
You must be signed in to change notification settings - Fork 10.1k
[Fundamentals ] Audit Logs #23784
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
[Fundamentals ] Audit Logs #23784
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
3 changes: 2 additions & 1 deletion
3
src/content/docs/fundamentals/account/account-security/abuse-contact.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
224 changes: 224 additions & 0 deletions
224
src/content/docs/fundamentals/account/account-security/audit-logs.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,224 @@ | ||||||
| --- | ||||||
| pcx_content_type: reference | ||||||
| title: Audit Logs - version 2 (beta) | ||||||
| sidebar: | ||||||
| order: 6 | ||||||
| label: Audit Logs - v2 | ||||||
| badge: | ||||||
| text: Beta | ||||||
|
|
||||||
| --- | ||||||
|
|
||||||
| import { APIRequest } from "~/components" | ||||||
|
|
||||||
| Cloudflare Audit Logs are account-based. All user-initiated actions are recorded automatically across both the Cloudflare API and Dashboard. System-initiated logs are also captured to reflect actions taken automatically by Cloudflare systems, such as configuration updates, background processes, or internal policy enforcement. | ||||||
|
|
||||||
| When a user-initiated action triggers additional automated behavior, corresponding system-initiated logs may be generated. In some cases, these system-initiated logs include additional enrichments that provide more context about what was changed, offering deeper visibility into the full lifecycle of the action. | ||||||
|
|
||||||
| When an action occurs, it is streamed through Cloudflare's audit logging pipeline and stored. This ensures consistent visibility into activity across all products. | ||||||
|
|
||||||
| 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/). | ||||||
|
|
||||||
| :::note | ||||||
| A transition plan from Audit Logs v1 to Audit Logs v2 will be communicated in due course. | ||||||
| ::: | ||||||
|
|
||||||
| ## Key features | ||||||
|
|
||||||
| 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. | ||||||
angelampcosta marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
|
||||||
| - **Standardized logging**: Audit logs are automatically generated in a consistent format across all Cloudflare services, ensuring uniformity and eliminating inconsistencies. | ||||||
| - **Expanded product coverage**: Audit Logs covers 111 products, capturing actions from key endpoints, such as `/accounts`, `/zones`, `/user`, and `/memberships` APIs. | ||||||
| - **Granular filtering**: Uniformly formatted logs allow for precise filtering by actions, actors, methods, and resources, facilitating efficient investigations. | ||||||
| - **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. | ||||||
angelampcosta marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
| - **Comprehensive activity capture**: Beyond create, edit, and delete actions, Audit Logs records GET requests and failed attempts, ensuring no critical activity is overlooked. | ||||||
|
|
||||||
| ## Retention | ||||||
|
|
||||||
| 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. | ||||||
angelampcosta marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
|
|
||||||
| ## Access Audit Logs | ||||||
|
|
||||||
| You can retrieve audit logs using one of the API or the dashboard. Audit Logs v2 will soon be available with Logpush. | ||||||
angelampcosta marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
|
|
||||||
| ### API | ||||||
|
|
||||||
| Audit Logs are available through the Cloudflare API. To retrieve audit logs, use the following endpoint: | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| ```bash | ||||||
| https://api.cloudflare.com/client/v4/accounts/{account_id}/logs/audit | ||||||
| ``` | ||||||
|
|
||||||
| 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: | ||||||
|
|
||||||
| - `account_id`: Your Cloudflare account identifier. | ||||||
| - `Since` (required): Start date for the audit log retrieval in the format yyyy-mm-dd. | ||||||
| - `Before` (required) : End date for the audit log retrieval in the format yyyy-mm-dd. | ||||||
|
|
||||||
| ```bash | ||||||
| GET https://api.cloudflare.com/client/v4/accounts/1234567890abcdef/logs/audit?since=2025-03-01T00:00:00Z&before=2025-03-26T23:59:59Z | ||||||
| ``` | ||||||
|
|
||||||
| ```json title="Example response" | ||||||
| { | ||||||
| "result": [ | ||||||
| { | ||||||
| "action": "zone.settings.change", | ||||||
| "actor": { | ||||||
| "email": "[email protected]", | ||||||
| "id": "0987654321abcdef" | ||||||
| }, | ||||||
| "ip": "192.0.2.1", | ||||||
| "method": "PUT", | ||||||
| "interface": "dashboard", | ||||||
| "resources": [ | ||||||
| { | ||||||
| "resource_id": "zone123", | ||||||
| "resource_type": "zone" | ||||||
| } | ||||||
| ], | ||||||
| "timestamp": "2025-03-15T14:25:37Z" | ||||||
| } | ||||||
| // Additional log entries | ||||||
| ], | ||||||
| "success": true, | ||||||
| "errors": [], | ||||||
| "messages": [] | ||||||
| } | ||||||
| ``` | ||||||
|
|
||||||
| 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)). | ||||||
|
|
||||||
| ### Dashboard | ||||||
|
|
||||||
| To access audit logs in the Cloudflare dashboard: | ||||||
|
|
||||||
| 1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/login) and select your account. | ||||||
| 2. Go to **Manage Account** > **Audit Log**. | ||||||
angelampcosta marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
|
|
||||||
| :::note | ||||||
| The Audit Logs v1 UI is shown by default, and users can switch between Audit Logs v1 and v2 as needed. | ||||||
angelampcosta marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
| ::: | ||||||
|
|
||||||
| ## Audit Log structure | ||||||
|
|
||||||
| 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. | ||||||
|
|
||||||
| ### Initiation type | ||||||
|
|
||||||
| 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. | ||||||
|
|
||||||
| #### User initiated Audit Logs | ||||||
|
|
||||||
| 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: | ||||||
angelampcosta marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
|
|
||||||
| - `actor_type="user"`: Action was performed by an individual user. | ||||||
| - `actor_type="Cloudflare_admin"`: Action was performed by Cloudflare. | ||||||
| - `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. | ||||||
|
|
||||||
| #### System initiated Audit Logs | ||||||
|
|
||||||
| 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"`). | ||||||
|
|
||||||
| ### Activity Scope | ||||||
|
|
||||||
| #### Account Activity Logs | ||||||
|
|
||||||
| 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"`). | ||||||
angelampcosta marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
|
|
||||||
| #### User Profile Activity Logs | ||||||
|
|
||||||
| 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"`. | ||||||
|
|
||||||
| The `GET /memberships` endpoint supports cross-account access. To query memberships, use the parameter `resource_scope=memberships`. | ||||||
|
|
||||||
| ## Example how to query Audit Logs | ||||||
|
|
||||||
| Use the following example to get a list of audit logs for a user account. | ||||||
|
|
||||||
| <APIRequest | ||||||
| method="GET" | ||||||
| path="/accounts/{account_id}/logs/audit" | ||||||
| /> | ||||||
|
|
||||||
| ```json title="Example response" | ||||||
| { | ||||||
| "errors": [ | ||||||
| { | ||||||
| "message": "message" | ||||||
| } | ||||||
| ], | ||||||
| "result": [ | ||||||
| { | ||||||
| "account": { | ||||||
| "id": "4bb334f7c94c4a29a045f03944f072e5", | ||||||
| "name": "Example Account" | ||||||
| }, | ||||||
| "action": { | ||||||
| "description": "Add Member", | ||||||
| "result": "success", | ||||||
| "time": "2024-04-26T17:31:07Z", | ||||||
| "type": "create" | ||||||
| }, | ||||||
| "actor": { | ||||||
| "id": "f6b5de0326bb5182b8a4840ee01ec774", | ||||||
| "context": "dash", | ||||||
| "email": "[email protected]", | ||||||
| "ip_address": "198.41.129.166", | ||||||
| "token_id": "token_id", | ||||||
| "token_name": "token_name", | ||||||
| "type": "user" | ||||||
| }, | ||||||
| "raw": { | ||||||
| "cf_ray_id": "8e9b1c60ef9e1c9a", | ||||||
| "method": "POST", | ||||||
| "status_code": 200, | ||||||
| "uri": "/accounts/4bb334f7c94c4a29a045f03944f072e5/members", | ||||||
| "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Safari/605.1.15" | ||||||
| }, | ||||||
| "resource": { | ||||||
| "id": "id", | ||||||
| "product": "members", | ||||||
| "request": {}, | ||||||
| "response": {}, | ||||||
| "scope": {}, | ||||||
| "type": "type" | ||||||
| }, | ||||||
| "zone": { | ||||||
| "id": "id", | ||||||
| "name": "example.com" | ||||||
| } | ||||||
| } | ||||||
| ], | ||||||
| "result_info": { | ||||||
| "count": "1", | ||||||
| "cursor": "ASqdKd7dKgxh-aZ8bm0mZos1BtW4BdEqifCzNkEeGRzi_5SN_-362Y8sF-C1TRn60_6rd3z2dIajf9EAPyQ_NmIeAMkacmaJPXipqvP7PLU4t72wyqBeJfjmjdE=" | ||||||
| }, | ||||||
| "success": true | ||||||
| } | ||||||
| ``` | ||||||
|
|
||||||
| ## Common terms and definitions | ||||||
|
|
||||||
| ### Actor | ||||||
|
|
||||||
| 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`). | ||||||
angelampcosta marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
|
|
||||||
| ### Action | ||||||
|
|
||||||
| 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`). | ||||||
| All `GET` requests are captured as `view` actions in Audit Logs. | ||||||
angelampcosta marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
|
||||||
| ### Account | ||||||
|
|
||||||
| 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. | ||||||
|
|
||||||
| ### Resource | ||||||
|
|
||||||
| 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. | ||||||
|
|
||||||
| ### Audit Log ID | ||||||
|
|
||||||
| This is a unique identifier for the log record itself. It can be used for deduplication, correlation, or referencing specific actions during investigations. | ||||||
|
|
||||||
|
|
||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
...nt/docs/fundamentals/account/account-security/leaked-password-notifications.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,8 @@ | ||
| --- | ||
| pcx_content_type: reference | ||
| title: Leaked Password Notifications | ||
| sidebar: | ||
| order: 3 | ||
|
|
||
| --- | ||
|
|
||
|
|
||
3 changes: 2 additions & 1 deletion
3
src/content/docs/fundamentals/account/account-security/manage-active-sessions.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 7 additions & 2 deletions
9
src/content/docs/fundamentals/account/account-security/review-audit-logs.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.