# AuditEntry

> Tracon documentation. Tracon is a .NET package family that adds a control
> plane on Microsoft Agent Framework, published as NuGet packages that run
> inside your own ASP.NET Core application.
>
> Page: https://tracon.dev/api/tracon.auditentry/
> Summary: AuditEntry: A row in the audit trail that records who changed which entity and when.

<div class="api-provenance">Namespace Tracon · Assembly <code>Tracon.Abstractions.dll</code></div>

A row in the audit trail that records who changed which entity and when.

```csharp
public sealed record AuditEntry : IEquatable<AuditEntry>
```

<dl class="api-relations"><dt>Inheritance</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.object">object</a> ← <a href="/api/tracon.auditentry/">AuditEntry</a></dd><dt>Implements</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.iequatable-1">IEquatable&lt;AuditEntry&gt;</a></dd><dt>Inherited Members</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.object.gettype">object.GetType()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.tostring">object.ToString()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)">object.Equals(object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">object.Equals(object?, object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.referenceequals">object.ReferenceEquals(object?, object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.gethashcode">object.GetHashCode()</a></dd></dl>

## Remarks

[AuditEntry.Before](/api/tracon.auditentry/#Tracon_AuditEntry_Before) and [AuditEntry.After](/api/tracon.auditentry/#Tracon_AuditEntry_After) pass through a secret filter before they
are written: the values of the `apiKey`, `authorization`, `token`,
`password` and `secret` keys are replaced with `"***"`.

Runs (an agent processing a message) are **not written** to this trail.
The `runs` table already holds the full record; writing it a second time would
turn the audit trail into the largest table and make it unreadable.

## Constructors

### <a id="Tracon_AuditEntry__ctor"></a> AuditEntry\(\)

```csharp
public AuditEntry()
```

## Properties

### <a id="Tracon_AuditEntry_Action"></a> Action

Gets the action name, for example `agent.update`.

```csharp
public required string Action { get; init; }
```

#### Property Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)

### <a id="Tracon_AuditEntry_Actor"></a> Actor

Gets the actor that made the change. It is [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) when there is no
authentication or the actor cannot be resolved; that state is not hidden.

```csharp
public string? Actor { get; init; }
```

#### Property Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)?

### <a id="Tracon_AuditEntry_After"></a> After

Gets the state after the change, as JSON text. Tracon's own write path
removes secret-named fields first; a caller that writes to
[IAuditLog](/api/tracon.iauditlog/) directly must not put a secret value here.

```csharp
public string? After { get; init; }
```

#### Property Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)?

### <a id="Tracon_AuditEntry_Before"></a> Before

Gets the state before the change, as JSON text. Tracon's own write path
removes secret-named fields first; a caller that writes to
[IAuditLog](/api/tracon.iauditlog/) directly must not put a secret value here.

```csharp
public string? Before { get; init; }
```

#### Property Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)?

### <a id="Tracon_AuditEntry_CreatedAt"></a> CreatedAt

Gets the time the record was written (UTC).

```csharp
public required DateTimeOffset CreatedAt { get; init; }
```

#### Property Value

 [DateTimeOffset](https://learn.microsoft.com/dotnet/api/system.datetimeoffset)

### <a id="Tracon_AuditEntry_Entity"></a> Entity

Gets the affected entity, for example `agent:support`.

```csharp
public required string Entity { get; init; }
```

#### Property Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)

### <a id="Tracon_AuditEntry_Hash"></a> Hash

Gets the hash of this entry: a SHA-256 over a canonical form of its
fields that also includes the previous entry's hash, so changing an
earlier entry breaks every later link. The write path computes this
value; a caller-supplied value is ignored.

```csharp
public string? Hash { get; init; }
```

#### Property Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)?

### <a id="Tracon_AuditEntry_Id"></a> Id

Gets the record id. A time-ordered UUID (v7).

```csharp
public required Guid Id { get; init; }
```

#### Property Value

 [Guid](https://learn.microsoft.com/dotnet/api/system.guid)

### <a id="Tracon_AuditEntry_PreviousHash"></a> PreviousHash

Gets the hash of the previous entry of the same tenant.
[null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) for the first entry of a tenant.

```csharp
public string? PreviousHash { get; init; }
```

#### Property Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)?

#### Remarks

The chain is per `TenantId`: one tenant's write rate never waits on
another tenant's chain. The write path computes this value; a caller-supplied
value is ignored.

### <a id="Tracon_AuditEntry_TenantId"></a> TenantId

Gets the tenant the change belongs to.

```csharp
public required string TenantId { get; init; }
```

#### Property Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)

## Methods

### <a id="Tracon_AuditEntry_Equals_System_Object_"></a> Equals\(object?\)

```csharp
public override bool Equals(object? obj)
```

#### Parameters

`obj` [object](https://learn.microsoft.com/dotnet/api/system.object)?

#### Returns

 [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

### <a id="Tracon_AuditEntry_Equals_Tracon_AuditEntry_"></a> Equals\(AuditEntry?\)

```csharp
public bool Equals(AuditEntry? other)
```

#### Parameters

`other` [AuditEntry](/api/tracon.auditentry/)?

#### Returns

 [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

### <a id="Tracon_AuditEntry_GetHashCode"></a> GetHashCode\(\)

```csharp
public override int GetHashCode()
```

#### Returns

 [int](https://learn.microsoft.com/dotnet/api/system.int32)

### <a id="Tracon_AuditEntry_ToString"></a> ToString\(\)

```csharp
public override string ToString()
```

#### Returns

 [string](https://learn.microsoft.com/dotnet/api/system.string)

## Operators

### <a id="Tracon_AuditEntry_op_Equality_Tracon_AuditEntry_Tracon_AuditEntry_"></a> operator ==\(AuditEntry?, AuditEntry?\)

```csharp
public static bool operator ==(AuditEntry? left, AuditEntry? right)
```

#### Parameters

`left` [AuditEntry](/api/tracon.auditentry/)?

`right` [AuditEntry](/api/tracon.auditentry/)?

#### Returns

 [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

### <a id="Tracon_AuditEntry_op_Inequality_Tracon_AuditEntry_Tracon_AuditEntry_"></a> operator \!=\(AuditEntry?, AuditEntry?\)

```csharp
public static bool operator !=(AuditEntry? left, AuditEntry? right)
```

#### Parameters

`left` [AuditEntry](/api/tracon.auditentry/)?

`right` [AuditEntry](/api/tracon.auditentry/)?

#### Returns

 [bool](https://learn.microsoft.com/dotnet/api/system.boolean)
