Skip to main content

Filesystem storage

AlmaForge stores audit events and session recordings directly on a local filesystem or network share (such as NFS). No external cloud object storage or database is required.

Local storage is handled by three complementary drivers:

  1. dir (default & recommended): Manages a structured directory hierarchy for both audit events and session recordings.
  2. file: Appends audit events to a single flat file for log forwarders (Fluent Bit, Vector, Splunk).
  3. stdout: Streams audit events to standard output in containerized environments (Kubernetes).
DriverStorage roleSupported dataBest used for
dirStructured directoryAudit events and session recordingsDefault local storage, single-node evaluation, and multi-node NFS shares
fileFlat append fileAudit events onlyForwarding logs to host-level collectors (tail -f, SIEM)
stdoutStandard output streamAudit events onlyKubernetes and containerized log scraping
Zero-configuration default

If you do not author any storage manifests or environment variables, AlmaForge automatically uses the dir driver under /var/lib/almaforge/audit.

TL;DR​

  1. Use the default dir storage under /var/lib/almaforge/audit, or specify a custom path in StorageConfig manifests.
  2. Place StorageConfig manifests for recordings and audit in /etc/almaforge/almad.d on each Auth host.
  3. Restart almad and verify session replay and audit search with alma.

Prerequisites​

Before you start, make sure you have:

  • A local directory or network mount (e.g. NFS) with sufficient disk space for audit logs and session recordings.
  • Root access or appropriate write permissions on the target storage path.
  • A cluster state backend already configured (SQLite, PostgreSQL, DynamoDB, etcd, or Firestore).

Configuration​

This fast path configures local filesystem storage using declarative manifests in /etc/almaforge/almad.d. For flat-file streaming, container stdout, NFS clustering, or internal storage layout, see Advanced.

Step 1. Choose your storage path​

By default, AlmaForge writes to /var/lib/almaforge/audit (typically /var/lib/almaforge/audit/). You can use this default or specify an alternative path (such as a mounted disk or network share).

note

A cluster upgraded from an earlier release wrote audit events to /var/lib/almaforge/log and recordings to /var/lib/almaforge/records. Those files stay where they are and are not read from the new path. See the changelog for what to move.

ParameterRequiredDefaultDescription
pathyes/var/lib/almaforge/auditDirectory path on every Auth host, writable by almad.

Step 2. Configure session recordings​

To store recordings locally, place a StorageConfig manifest with metadata.name: recordings in /etc/almaforge/almad.d on every Auth host (see Bootstrap configuration). There is exactly one recordings instance per cluster.

recordings.yaml:

examples/storage/local/recordings.yaml
# Session recordings on each Auth host's filesystem, under records/ and
# records-index/ of the path given.
apiVersion: almaforge.com/v1
kind: StorageConfig
metadata:
name: recordings
spec:
dir:
path: /var/lib/almaforge/audit

Step 3. Configure audit events​

To store audit events locally, place a StorageConfig manifest with metadata.name: audit in /etc/almaforge/almad.d on every Auth host:

audit.yaml:

examples/storage/local/audit.yaml
# Audit events on each Auth host's filesystem. One path also serves the
# recordings instance, which writes under records/ beside events/.
apiVersion: almaforge.com/v1
kind: StorageConfig
metadata:
name: audit
spec:
dir:
path: /var/lib/almaforge/audit

Step 4. Restart and verify​

Restart the Auth Service and verify that your storage resources are active:

Terminal
sudo systemctl restart almadalma get storageconfig/audit -o yamlalma get storageconfig/recordings -o yaml

Next, open and terminate an SSH session, then confirm that recordings and audit events are searchable:

Terminal
# List recent recordingsalma recording ls --last=1h
# Search recent audit eventsalma audit --last=1h

If both commands return your test session, your read and write paths are fully operational.

Advanced​

Storage layout and compression internals​

The dir driver organizes session recordings and audit events under dedicated subdirectories of your configured path:

text
/var/lib/almaforge/audit/
├── records/
│ └── <session-id>.pb Session recording payload
├── records-index/
│ └── 2026/11/16/09/
│ └── <unix-nanos>-<session-id>.jsonl.gz Fast listing index
└── events/
└── 2026/11/
├── 14/
│ └── 2026-11-14-<host-id>.jsonl.gz Older days: automatically compressed
├── 15/
│ └── 2026-11-15-<host-id>.jsonl Yesterday: plain text grace period
└── 16/
├── 2026-11-16-<host-id>.jsonl Today: active plain text append
└── 2026-11-16-<other-host>.jsonl Safe multi-node writes (one file per host)

Session recordings

Session recordings are stored exclusively under records/. Each recording is named by its session ID (<session-id>.pb), accompanied by an index entry under records-index/ so that replay listings sort chronologically without scanning entire files.

Audit events and delayed compression

Audit events are stored under events/, partitioned by day and host ID:

  • Grace period: The current day and the previous day always remain uncompressed plain text (.jsonl) so that log forwarders and live searches can read events without contention.
  • Automatic delayed compression: Days older than yesterday are automatically compressed in place to .jsonl.gz, saving 80–90% disk space while remaining fully searchable.
  • Multi-node safety: Because each file includes <host-id>, multiple Auth Service instances sharing an NFS mount write to their own files without locks or write collisions.

Both audit events and session recordings live under one unified path because each uses dedicated prefixes (events/, records/, records-index/). This mirrors S3 bucket layout conventions, making future cloud migrations straightforward.

Streaming audit events to log collectors (file driver)​

If you use a host log forwarder (such as Fluent Bit, Vector, or Splunk Universal Forwarder) that tails a fixed file path, add a file instance alongside your primary dir instance using audit fan-out:

audit-file.yaml:

examples/storage/local/audit-file.yaml
# A second audit destination for a log collector to follow. The path is
# the file itself, appended to and never rotated by AlmaForge, and it
# holds no recordings.
apiVersion: almaforge.com/v1
kind: StorageConfig
metadata:
name: audit-collector
spec:
file:
path: /var/log/almaforge/audit.jsonl
  • Behavior: The file driver continuously appends JSON Lines to the target path without in-process rotation, renaming, or compression.
  • Collector friendly: Log forwarders can run tail -f /var/log/almaforge/audit.jsonl without handling symlink switches or mid-stream file resets.

Streaming to standard output in containers (stdout driver)​

In Kubernetes or container runtimes where log aggregators read directly from container stdout, use the stdout driver:

audit-stdout.yaml:

examples/storage/local/audit-stdout.yaml
# Audit events on the process's standard output, for a container
# platform that collects it. Nothing can be searched back out of this,
# so pair it with an instance that can be read.
apiVersion: almaforge.com/v1
kind: StorageConfig
metadata:
name: audit-stdout
spec:
stdout: {}
stdout is write-only

Because stdout cannot be queried back, alma audit and the Web UI Audit Log will have nothing to display if stdout is your only audit sink. Keep a dir instance configured alongside stdout if you want events queryable within AlmaForge.

Multi-node clusters with shared network storage (NFS / EFS)​

To run a multi-node Auth Service pool with shared filesystem storage instead of cloud object storage, mount an NFS, AWS EFS, or CephFS share at the same path on all Auth hosts.

  • Why it works: The dir driver isolates writes by appending -<host-id> to daily event filenames. No file locking or distributed synchronization is required.
  • Cluster state requirement: Keep cluster state (name: state) off NFS. SQLite requires a local POSIX block device. For multi-node clusters, use PostgreSQL or another networked state store.

Environment variables (URI syntax)​

If you configure AlmaForge via environment variables instead of YAML manifests, use the dir:/// URI scheme:

env
ALMA_AUDIT_URI=dir:///var/lib/almaforge/audit
ALMA_RECORDINGS_URI=dir:///var/lib/almaforge/audit

Migrating to Amazon S3​

When scaling up to AWS S3:

  1. Recordings: Sync directly to your S3 bucket. Because dir and s3 use identical structures for recordings (see S3 storage layout and internals), index entries transfer seamlessly:
    Terminal
    aws s3 sync /var/lib/almaforge/audit/records s3://my-bucket/audit/recordsaws s3 sync /var/lib/almaforge/audit/records-index s3://my-bucket/audit/records-index
  2. Audit events: Do not sync existing local audit files to S3. Local disk partitions by day (events/YYYY/MM/DD/), whereas S3 partitions by hour flushes (events/YYYY/MM/DD/HH/). Instead, keep the existing dir instance configured as a secondary audit sink so historical events remain queryable.

Troubleshooting​

Search returns no results from file or stdout​

stdout cannot be queried. A file instance only searches the single currently configured file (rotated-out files are invisible to the search engine). To ensure full search functionality in the Web UI and CLI, always maintain an active dir instance.

Partial audit data across a multi-node cluster​

If each Auth host writes to its own unshared local disk, each node only knows about the events it processed. To get a unified cluster view, mount a shared NFS volume using the dir driver, or transition to Amazon S3.

The same applies to recordings, and more sharply: a recording is written by whichever Auth host terminated its upload and is never moved afterwards, so on unshared disks it can only be replayed from that host.

A search reports too many events in a day​

A dir search reads one day at a time and will not return more than 100,000 matching events from a single day. The size of the day itself does not matter, so asking for the last few minutes of a very busy day is fine. Narrow the window, or ask for specific event types. A cluster that routinely wants more than that out of one day belongs on a database driver or Amazon S3, which answer a search without reading a day's worth of events.

Operations​

Log rotation for file instances​

A dir instance needs no rotation. It starts a file each day on its own and compresses the days that stop being current.

A file instance appends to one path indefinitely, so rotate it with logrotate in the ordinary way. almad holds the file open, so tell it to pick up the new one afterwards: SIGHUP makes it start a replacement process, which opens the configured path fresh, and the outgoing process then shuts down gracefully.

/etc/logrotate.d/almaforge
/var/log/almaforge/audit.jsonl {
daily
rotate 14
compress
delaycompress
missingok
notifempty
postrotate
systemctl kill -s HUP almad
endscript
}

delaycompress matters when compress is on. The outgoing process keeps writing to the rotated file for as long as it takes to drain, and compressing that file while it is still open would discard whatever it writes after the compressed copy is taken. Waiting one cycle lets the old process exit first.

Retention and pruning​

AlmaForge does not automatically delete expired recordings or audit events from the filesystem:

  • Audit events: You can delete old day directories under events/YYYY/MM/DD/ at any time using standard cron jobs or find commands.
  • Recordings: When deleting old recordings from records/, always delete the corresponding index entries under records-index/. Removing a recording without its index entry leaves broken listings in alma recording ls.

Permissions and security​

  • dir driver: Kept private to AlmaForge. Directories are created with mode 0700 and files with mode 0600, owned by the process user (root).
  • file driver: Created with mode 0640 in a 0750 directory so that unprivileged log collection agents (running in the file's group) can tail the file without root privileges.
  • Pre-existing paths retain their existing ownership and permissions.

References​