Skip to content

Observability & Audit

Find out whether a repository is ready to ship, what changed between builds, and what happened when, and keep an old build’s packages from being collected.

Before you ship a repository you want to know whether it is consistent, what changed since the last delivery, and what happened when. Sometimes you also need an old build’s packages to stay on disk after newer builds stop using them. For a standard repository, SOW answers each question with its own command, from a cheap state lookup to a full re-hash of every file:

Question Command Cost When to run it
Does the repository need a build or recovery? Is a writer active? status Reads recorded state; hashes nothing Any time, including before writes and from monitoring
Are package bytes, indexes, and signatures consistent and ready for delivery? check Reads and hashes every package file After a build, before you publish or copy
Which local files changed between two builds? changes Verifies the current tree like check, then compares recorded manifests When you review a delivery or feed another sync tool
Which operations ran, when, and what did they change? log Reads the operation journal When you investigate a change or archive history
Which Generations (completed builds) are explicitly retained? retain ls Reads retention records Before you collect unused packages

These commands do not modify repository contents.

In a normal workflow

sow add ./incoming/*.rpm -r demo -d el9    # import and build
sow status -r demo                          # status=clean: nothing pending
sow check -r demo                           # exit 0: ready to deliver
sow changes -r demo                         # what this build changed
sow publish TARGET

check is the delivery gate. Exit 0 means every layer passed and the repository is ready to copy; exit 5 means it is not, and the diagnostic names the failed layer or the pending state. log is for afterwards, when you need to know which operation changed what.

Inspect state

sow status -r demo

status reports the desired-state revision, the built Generation, the Dists (package sets such as el9) that need a build, the count and bytes of pending packages, whether a writer holds the lock, and ready_to_copy, which is true only when the state is clean and no writer is active.

State Meaning
clean The built state matches the desired state
dirty Membership or configuration needs a build
recovering Recorded work needs recovery or cleanup
error Recorded state or file evidence has an unresolved error

For dirty, run build. For recovering or error, follow the diagnostic and the recovery procedure. status exits 0 for every state it can read, so scripts should read the state rather than the exit code. Because it hashes nothing, ready_to_copy describes the recorded state, not the files; run check before delivery.

Verify the repository

sow check -r demo
repository=demo status=clean ready_to_copy=true revision=4 generation=6
config	ok=true	checked=3
state	ok=true	checked=1
public-modes	ok=true	checked=25
retained	ok=true	checked=0
package-bytes	ok=true	checked=4
desired-membership	ok=true	checked=4
index	ok=true	checked=1
signature	ok=true	checked=10
generation-manifest	ok=true	checked=1

check ignores cached fingerprints: it reads and hashes each unique package file, checks every index against the membership it claims, verifies the configured metadata and RPM package signatures, and compares the public tree with the build’s file manifest. It repairs nothing. A dirty or recovering repository fails even if its last built tree is intact, because that tree is not what you asked for; run build and check again. sow check describes each layer.

Compare Generations

sow changes -r demo               # current build against its predecessor
sow changes 0 -r demo             # the complete current tree
sow changes 42 -r demo --json     # recorded Generation 42 against the current build
sow changes -r demo
base=5 generation=6 dirty=false
add	payload	pool/c/centos-release/centos-release-7-2.1511.el7.centos.2.10.x86_64.rpm	23516	b4111ef2...
add	metadata	dists/el9/x86_64/repodata/fbf323c7...-primary.xml.gz	1607	fbf323c7...
update	pointer	dists/el9/x86_64/repodata/repomd.xml	1541	8fef2510...
delete	delete	dists/el9/x86_64/repodata/b71da59c...-primary.xml.gz	0

Each row gives the action, the phase, the repository-relative path, and, where applicable, the size and SHA-256. Phases follow the build order: payload, metadata, pointer, delete. Because changes verifies the current tree first, it fails with exit 5 while the repository is recovering or damaged.

changes compares local builds and does not inspect a publication target. Run sow publish TARGET to update a target and resume interrupted transfers, and target GC to reclaim remote objects.

Retain Generations and collect unused packages

Package files stay in the pool after they leave the index: clients of the previous build may still download them, and nothing is deleted until you run sow gc, which removes only files that nothing needs any more. If you need a particular build’s exact package files and metadata kept, for example a release you shipped to customers, retain it. SOW verifies the Generation, saves its metadata and file manifest under .sow/<repo>/retained/, and keeps its package files out of gc. Retention does not serve or publish that build; it keeps the material on disk.

retain add accepts only the current built Generation, so retain a build before the next build replaces it. If status shows generation=42:

sow retain add 42 -r demo
sow retain ls -r demo

When you no longer need it, remove the record with sow retain rm 42 -r demo, then run sow gc -r demo to collect unused bytes. If retain rm or gc stops partway, rerun the same command to finish its recorded plan.

Local gc requires a clean repository, so build pending changes first. It keeps every package still needed by desired or built membership, the membership kept for clients of the previous build, a retained Generation, recovery, or publication state; see gc for the complete rules. The previous build’s metadata that ordinary builds keep is separate from explicit retention. For a publication target, run sow gc TARGET: filesystem targets delete eligible objects conditionally after the cache grace period, and on R2 the default run writes a candidate report and sow gc TARGET --delete reclaims eligible objects.

Read and export the log

sow log -r demo
sow log OPERATION -r demo
sow log export operations.jsonl -r demo
sow log prune 2026-01-01 -r demo

The log is the operation journal, kept after operations finish. It records each operation’s state and times and, where applicable, its package results, membership changes, and file changes; an operation’s detail can also include build-progress events.

log export writes completed operations as JSON Lines to a new file, or to stdout. log prune accepts a date or an RFC 3339 timestamp and removes eligible terminal records older than it. Records that recovery needs and Generation manifests remain, so changes against an older Generation keeps working.

See JSON output for scripts.

Table reader