Unattended Installation
This document contains useful information when automating/scripting the installation and configuration of a Seq server on Windows.
Silent installs using the Seq MSI
Seq can be installed using msiexec.exe
command-line utility, which is included as a part of Windows. This requires the Seq .msi
installer.
msiexec.exe
has several command-line options; the basic installation command looks like:
start /wait msiexec /q /i Seq-<version>.msi WIXUI_EXITDIALOGOPTIONALCHECKBOX=0
Passing WIXUI_EXITDIALOGOPTIONALCHECKBOX=0
prevents the Seq Administration app from being launched.
Installing and configuring the Seq Windows Service
After the MSI has completed, the Seq executables will reside in C:\Program Files\Seq
, but no running Seq instance will be configured.
To set up the Seq Windows Service, Seq.exe
needs to be invoked, passing the
seq install --storage="C:\ProgramData\Seq" --listen="http://localhost:5341"
seq start
See Server Command Line and Server Configuration for details of how the seq install
and related seq config
commands work.
If an SSL endpoint is required, seq bind-ssl
must be invoked before seq start
. See Windows HTTPS (TLS/SSL) for instructions.
Enabling authentication
Once the Seq service has started, the HTTP API can be used to install a license certificate and enable authentication.
Ensure this step is completed before opening firewall ports or routing traffic to the Seq instance.
API automation is easiest in C# using the Seq.Api NuGet package. Alternatively, some tasks can be completed using the Command-line Client.
The required code will resemble:
var connection = new SeqConnection("http://localhost:5341");
// Assuming the existence of a Seq license certificate in license.txt
var current = await connection.Licenses.FindCurrentAsync();
using (var reader = File.OpenText("license.txt"))
{
current.LicenseText = await reader.ReadToEndAsync();
}
await connection.Licenses.UpdateAsync(current);
var admin = await connection.Users.FindCurrentAsync();
admin.NewPassword = "hellotest123!";
await connection.Users.UpdateAsync(admin);
var iae = await connection.Settings.FindNamedAsync(SettingName.IsAuthenticationEnabled);
iae.Value = true;
await connection.Settings.UpdateAsync(iae);
await connection.Users.LoginAsync(admin.Username, "hellotest123!");
// More setup here now that the connection is authenticated...
Retention policies, user accounts, etc.
These tasks can also be completed using the HTTP API. For example, a seven-day retention policy can be enabled with:
var policy = await connection.RetentionPolicies.TemplateAsync();
policy.RetentionTime = TimeSpan.FromDays(7);
policy = await connection.RetentionPolicies.AddAsync(policy);
Seq will automatically record encrypted configuration backups each day, and retain these for seven days. Restoring those backups will require the master key, which must be explicitly retrieved and kept in a safe place. See the Backup and Restore documentation for details.
Updated over 5 years ago