# Interface AuditSink

Pluggable audit sink interface.

Implement this to create custom log destinations (files, SIEM, syslog …).

#### Example

    class MyCustomSink implements AuditSink {
      write(entry: AuditLogEntry): void {
        myExternalSystem.send(entry);
      }
    }

interface AuditSink {
write(entry: AuditLogEntry): void | Promise<void>;
clear?(authorization?: string): void;
query?(filter: AuditFilter): AuditLogEntry[];
}

#### Implemented by

- FileAuditSink
- MemoryAuditSink
- StderrAuditSink
- StructuredJsonSink

- Defined in utils/auditSink.ts:86

##### Index

### Methods

write
clear?
query?

## Methods

### write

- write(entry: AuditLogEntry): void | Promise<void>

  Write a single audit entry to the sink

  #### Parameters

  - entry: AuditLogEntry

  #### Returns void | Promise<void>

  - Defined in utils/auditSink.ts:88

### `Optional` clear

- clear?(authorization?: string): void

  Clear all entries. Implemented by in-memory sinks; write-only sinks omit this. The `authorization` parameter may be provided by callers; validation is the responsibility of the calling context (typically AuditLogger).

  #### Parameters

  - `Optional` authorization: string

  #### Returns void

  - Defined in utils/auditSink.ts:100

### `Optional` query

- query?(filter: AuditFilter): AuditLogEntry[]

  Query entries matching a filter. Implemented by in-memory sinks; write-only sinks omit this.

  #### Parameters

  - filter: AuditFilter

  #### Returns AuditLogEntry[]

  - Defined in utils/auditSink.ts:93