# Class FileAuditSink

Appends audit entries as newline-delimited JSON (NDJSON) to a file.

Log rotation: when the file reaches `maxSizeBytes`, it is renamed to `<filePath>.<timestamp>.bak` before the new entry is written.

#### Security

The log file should be stored on a volume with restricted write permissions; only the server process account should have write access.

#### Since

0.9.0

#### Implements

- AuditSink

- Defined in utils/auditSink.ts:287

##### Index

### Constructors

constructor

### Properties

filePath
maxSizeBytes
writeQueue

### Methods

rotateIfNeeded
write

## Constructors

### constructor

- new FileAuditSink(options: FileAuditSinkOptions): FileAuditSink

  #### Parameters

  - options: FileAuditSinkOptions

  #### Returns FileAuditSink

  - Defined in utils/auditSink.ts:296

## Properties

### `Private` `Readonly` filePath

filePath: string

- Defined in utils/auditSink.ts:288

### `Private` `Readonly` maxSizeBytes

maxSizeBytes: number

- Defined in utils/auditSink.ts:289

### `Private` writeQueue

writeQueue: Promise<void> = ...

Serialises concurrent write calls so that stat + rename + appendFile sequences never interleave across parallel `log()` invocations.

- Defined in utils/auditSink.ts:294

## Methods

### `Private` rotateIfNeeded

- rotateIfNeeded(): Promise<void>

  #### Returns Promise<void>

  - Defined in utils/auditSink.ts:318

### write

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

  Write a single audit entry to the sink

  #### Parameters

  - entry: AuditLogEntry

  #### Returns Promise<void>

  Implementation of AuditSink.write

  - Defined in utils/auditSink.ts:306