Seq stores two kinds of data. Log events are stored in Seq's own storage engine, called Flare. Documents, like users and signals are stored in a separate metastore, which may be ESENT on Windows, LMDB on Linux, or a SQL database like SQL Server or PostgreSQL.
The ESENT and LMDB metastores are convenient and self-contained, but may not work reliably on some cloud filesystems. In those environments PostgreSQL may already be used by applications themselves, and could be a more reliable place to store Seq's documents.
Events aren't stored in the metastore
Seq won't store log events in the PostgreSQL database. Only documents like users and signals will be stored there. Since the metastore is usually small, even for large instances, you probably won't need to provision a large server for its documents.
Multiple Seq instances using the same Postgres metastore are not supported
You'll need to configure a (DR) Instance if you'd like to share a single metastore with multiple Seq instances.
metastore.postgres.connectionString configuration setting is given a non-null value then Seq will use that connection string as the source of the metastore.
seq secret set -k metastore.postgres.connectionString -v "Host=localhost;Port=5432;Database=seq"
The connection string can also be specified in the
SEQ_METASTORE_POSTGRES_CONNECTIONSTRING environment variable.
The first time it runs, Seq will execute its migrations on the chosen schema.
As an example, say we want to use the connection string
Host=localhost;Port=5432;Database=seq. An existing Seq instance can be migrated to this SQL Server database using the
metastore to-postgresql command:
seq metastore to-postgresql --connection-string "Host=localhost;Port=5432;Database=seq" --skip-config
In this example, we also pass
--skip-config, so that the connection string itself isn't saved into the
Seq.json file. To see a full list of options that
to-postgresql accepts, run
seq help metastore to-postgresql.
Now when starting the container, passing the same connection string in the
SEQ_METASTORE_POSTGRES_CONNECTIONSTRING environment variable will use that database as the metastore:
SEQ_METASTORE_POSTGRES_CONNECTIONSTRING="Host=localhost;Port=5432;Database=seq" seq run
Updated about 2 months ago