Class AuditLog
- Namespace
- Cloudflare.NET.AuditLogs.Models
- Assembly
- Cloudflare.NET.dll
Represents an audit log entry recording an action taken on account resources.
Audit logs are retained for 18 months (v1 API) or 30 days (v2 API). Use filtering parameters to narrow results when querying large datasets.
public record AuditLog : IEquatable<AuditLog>
- Inheritance
-
AuditLog
- Implements
- Inherited Members
Remarks
The timestamp location differs between API versions:
- v1 API: Uses the
whenfield at the top level - v2 API: Uses
action.timeinstead
Constructors
AuditLog(string, AuditLogAccount?, AuditLogAction, AuditLogActor, DateTime?, string?, JsonElement?, string?, string?, AuditLogOwner?, AuditLogResource?, AuditLogZone?, AuditLogRaw?)
Represents an audit log entry recording an action taken on account resources.
Audit logs are retained for 18 months (v1 API) or 30 days (v2 API). Use filtering parameters to narrow results when querying large datasets.
public AuditLog(string Id, AuditLogAccount? Account, AuditLogAction Action, AuditLogActor Actor, DateTime? When = null, string? Interface = null, JsonElement? Metadata = null, string? NewValue = null, string? OldValue = null, AuditLogOwner? Owner = null, AuditLogResource? Resource = null, AuditLogZone? Zone = null, AuditLogRaw? Raw = null)
Parameters
IdstringUnique identifier for this audit log entry.
AccountAuditLogAccountAccount where the action occurred.
ActionAuditLogActionDetails about the action performed.
ActorAuditLogActorInformation about who performed the action.
WhenDateTime?When the action occurred (v1 API, RFC3339 timestamp). Use Timestamp for cross-version compatibility.
InterfacestringInterface used for the action (e.g., "API", "UI").
MetadataJsonElement?Additional metadata about the action.
NewValuestringNew value after the action (for change operations).
OldValuestringPrevious value before the action (for change operations).
OwnerAuditLogOwnerOwner (account) of the resource.
ResourceAuditLogResourceThe resource that was acted upon.
ZoneAuditLogZoneZone context for zone-scoped actions.
RawAuditLogRawRaw HTTP request details (v2 API only).
Remarks
The timestamp location differs between API versions:
- v1 API: Uses the
whenfield at the top level - v2 API: Uses
action.timeinstead
Properties
Account
Account where the action occurred.
[JsonPropertyName("account")]
public AuditLogAccount? Account { get; init; }
Property Value
Action
Details about the action performed.
[JsonPropertyName("action")]
public AuditLogAction Action { get; init; }
Property Value
Actor
Information about who performed the action.
[JsonPropertyName("actor")]
public AuditLogActor Actor { get; init; }
Property Value
Id
Unique identifier for this audit log entry.
[JsonPropertyName("id")]
public string Id { get; init; }
Property Value
Interface
Interface used for the action (e.g., "API", "UI").
[JsonPropertyName("interface")]
public string? Interface { get; init; }
Property Value
Metadata
Additional metadata about the action.
[JsonPropertyName("metadata")]
public JsonElement? Metadata { get; init; }
Property Value
NewValue
New value after the action (for change operations).
[JsonPropertyName("newValue")]
public string? NewValue { get; init; }
Property Value
OldValue
Previous value before the action (for change operations).
[JsonPropertyName("oldValue")]
public string? OldValue { get; init; }
Property Value
Owner
Owner (account) of the resource.
[JsonPropertyName("owner")]
public AuditLogOwner? Owner { get; init; }
Property Value
Raw
Raw HTTP request details (v2 API only).
[JsonPropertyName("raw")]
public AuditLogRaw? Raw { get; init; }
Property Value
Resource
The resource that was acted upon.
[JsonPropertyName("resource")]
public AuditLogResource? Resource { get; init; }
Property Value
Timestamp
Gets the timestamp when the action occurred, regardless of API version. Returns When (v1 API) or Time (v2 API).
[JsonIgnore]
public DateTime Timestamp { get; }
Property Value
When
When the action occurred (v1 API, RFC3339 timestamp). Use Timestamp for cross-version compatibility.
[JsonPropertyName("when")]
public DateTime? When { get; init; }
Property Value
Zone
Zone context for zone-scoped actions.
[JsonPropertyName("zone")]
public AuditLogZone? Zone { get; init; }