Prerequisites
A rule that uploads writes files to a bucket, so a connected bucket is required for it. Connect one before creating a release with rules that upload: A retention-only rule — one with noupload block — does not upload anything, so it needs no bucket.
The generic prerequisites are covered in the Create a release guide.
Define the file rules
File rules are defined as YAML files in your Git repository. Below is an example rule that uploads all log files from the/var/log/robot directory to the
my-uploads-bucket bucket, and then deletes each local copy a week after its upload is
confirmed.
robot-logs.yaml
upload and retention are optional and independent. A rule with only retention uploads nothing and simply reclaims disk on the device:
scratch-cleanup.yaml
Source
A rule’ssource declares what the rule matches on the device: which files it manages,
and when a matching file is considered finished.
string
required
An absolute glob pattern that selects the files this rule manages.Must satisfy the following criteria:
- Absolute — it starts with
/ - At most 1024 bytes, with no control characters
- No
..segments, and no empty segments (//or a trailing/)
/var/log/robot/*.loginteger
default:"60"
How long, in seconds, a matching file’s size and modification time must stay unchanged
(quiescent) before it is considered stable. Going quiescent is what makes a file
eligible for upload and deletion.
Upload
A rule’supload block declares which registered bucket matching files are written to, and the object path within it.
The upload block is optional. If omitted, the rule only manages local retention.
string
required
Slug of the upload collection the resulting uploads are grouped into.Example:
robot-logsstring
required
Name of the registered bucket this rule uploads to.Example:
my-uploads-bucketstring
The template which defines the object path to which the uploaded file is written.The following variables are supported, which are filled in when each upload’s
object key is rendered:
Retention
A rule’sretention block governs deletion of the local copies of matching files. When
absent, the device retains matching files indefinitely (Miru never deletes them).
The retention block doesn’t go into effect until a file is considered stable. That is, its size and modification time have stayed unchanged for source.stability_window_secs.
boolean
Whether a file must have its upload durably confirmed before it may be deleted. Must be set when the rule has an
upload block.true— files are never deleted before their upload is confirmed.false— upload is best-effort; files may be deleted once they are eligible, even if their upload has not completed.
integer
required
How long, in seconds, the file lives on the device before it is scheduled for deletion. The clock starts as soon as the file is considered stable.Use
0 to delete the file as soon as it becomes eligible.Example: 604800Local deletion is performed by the Miru Agent. Deleting a file requires write access to
its parent directory — see file system access.
Add file rules to a release
File rules ride along withmiru release create — the same command that creates the release and its schemas. Include them with either flag (both may be repeated):
--file-rule <file>— a single file rule YAML file--file-rules <dir>— a directory of file rule YAML files

