Unattended Installation
This document contains useful information when automating/scripting the installation and configuration of a Seq server on Windows, or when installing Seq in a headless Server Core environment.
Downloading the MSI
Seq MSIs are hosted at datalust.co
using a simple URI structure like datalust.co/download/begin?version={semver}
. As an example, you can download an installer for 5.1.3364
like:
Invoke-WebRequest "https://datalust.co/download/begin?version=5.1.3364" -outfile "Seq.msi"
Silent installs using the Seq MSI
Seq can be installed using the 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-Process -Wait -FilePath msiexec -ArgumentList '/quiet /i Seq.msi WIXUI_EXITDIALOGOPTIONALCHECKBOX=0 INSTALLFOLDER="C:\Program Files\Seq"'
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. You may need to add the install directory to your path.
To set up the Seq Windows Service, Seq.exe
needs to be invoked, passing the storage location and listen URI.
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.
Configure Windows Firewall
Before Seq will be available to the outside world, it first needs to be exposed by the virtual machine.
At an administrative command prompt:
netsh advfirewall firewall add rule name="Open Seq Port 5341" dir=in action=allow protocol=TCP localport=5341
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 4 years ago