Event backup with JSON Archive
The JSON Archive app can be used to stream ingested events into rolling files of line-delimited JSON. These files are suitable as a long-term archive or for data recovery.
Seq itself ingests data using ACID semantics, but the JSON Archive app is best-effort; recently ingested events may not be written through JSON Archive if the server is shut-down while writing, or the storage itself fails.
Setting up JSON Archive
Installing the package
The package id of this app is Seq.App.JsonArchive. In Seq, go to settings > Apps and select Install from NuGet. You'll be presented with a dialog requesting the package id. Type it in, and press Install.
App instances
To the right of the app's name in the app list, select the link titled Start a new instance.... This will present a configuration page where settings can be applied to the app.
Check Stream incoming events to set up a live rolling backup of your log stream.
Specify a File set with a path to write files to. They don't need to reside on the same disk as Seq's own log stream; they can instead target cheaper cloud storage options.
You can configure multiple instances of JSON Archive using different Signals to route log events to different files.
Working with JSON Archive files
The contents of JSON Archive files are compact line-delimited JSON objects using the CLEF schema:
{"@t":"2023-09-06T00:32:25.8103450Z","@mt":"Building route table from controller metadata","@i":"3ec1eab8","@seqid":"event-be77189aae7008dbe40b2e0000000000","@l":"Debug","SourceContext":"Roastery.Web.Router","Application":"Roastery Web Frontend","Origin":"seqcli sample ingest"}
{"@t":"2023-09-06T00:32:25.8186976Z","@mt":"Binding route HTTP {HttpMethod} {RouteTemplate} to action method {Controller}.{Action}()","@i":"8e9d69c7","@seqid":"event-be785ee0ae7008dbe50b2e0000000000","@l":"Debug","HttpMethod":"GET","RouteTemplate":"api/orders","Controller":"OrdersController","Action":"List","SourceContext":"Roastery.Web.Router","Application":"Roastery Web Frontend","Origin":"seqcli sample ingest"}
These files can be worked with using standard command-line tools like jq, reingested into Seq using seqcli, or handled programmatically.
Updated 11 months ago