Install the Logship Agent as a Windows service
Enroll a Windows host, run the agent at boot, and verify disk records after restart.
Install the Logship Agent as a Windows service
Use this guide on the Windows machine you want to monitor. You need Administrator PowerShell, a running Logship instance, the backend URL reachable from this machine, and access to Settings → Account → Agents in the receiving account. Copy the account ID from account settings. The default backend port is 5000. The browser UI uses port 8000.
Check for an existing installation
Get-CimInstance Win32_Service -Filter "Name='logship.agent'" |
Select-Object Name, State, StartName, PathNameIf this returns a service, go to Upgrade an existing service below. For a new installation, use an empty installation directory. The release ZIP includes its own appsettings.json.
Download and configure
Open Settings → System → About → System type. On an x64 machine use win-x64. On an ARM64 machine change the value below to win-arm64. Both archives are available in release v0.9.25.
$ErrorActionPreference = 'Stop'
$runtime = 'win-x64'
$release = 'v0.9.25'
$install = Join-Path $env:ProgramFiles 'Logship Agent'
$state = Join-Path $env:ProgramData 'Logship\agent'
$zip = Join-Path $env:TEMP "LogshipAgent-$release-$runtime.zip"
Invoke-WebRequest "https://github.com/logship-io/logship-agent/releases/download/$release/LogshipAgent-$runtime.zip" -OutFile $zip
New-Item -ItemType Directory -Path $install
New-Item -ItemType Directory -Force -Path $state | Out-Null
icacls $state /inheritance:r /grant:r '*S-1-5-18:(OI)(CI)F' '*S-1-5-32-544:(OI)(CI)F'
if ($LASTEXITCODE -ne 0) { throw 'Could not secure the agent credential directory.' }
Expand-Archive -LiteralPath $zip -DestinationPath $install
$backend = (Read-Host 'Backend API base URL').TrimEnd('/')
$account = [guid](Read-Host 'Receiving account UUID')
Invoke-RestMethod "$backend/health/ready"
@{
Urls = 'http://127.0.0.1:0'
Output = @{ endpoint = $backend; account = $account.ToString(); dataPath = $state; interval = '00:00:05' }
Sources = @{ DiskInformation = @{ enabled = $true; interval = '00:00:30' } }
Logging = @{ LogLevel = @{ Default = 'Information' } }
} | ConvertTo-Json -Depth 5 | Set-Content -Encoding UTF8 (Join-Path $install 'appsettings.json')Enroll in the foreground
Keep the elevated terminal open. The agent authenticates before it finishes starting. Running it interactively for first enrollment makes the verification ID visible while approval is pending.
$exe = Join-Path $install 'Logship.Agent.ConsoleHost.exe'
& $exe --contentRoot $installIn the browser, open Settings → Account → Agents → Pending Approvals. Match the machine name and Device verification ID printed in the terminal, then approve. Wait for collection to begin. In Query, replace YOUR-MACHINE with the Windows machine name and execute:
System.Storage
| where timestamp > ago(10m) and machine =~ "YOUR-MACHINE"
| project timestamp, machine, Name, TotalSizeBytes, AvailableFreespaceBytes
| order by timestamp desc
| take 10After you see a recent disk record, press Ctrl+C in the terminal and wait for the process to exit. The service will reuse the enrollment in the same data directory.
Start at boot and verify
Run in the same Administrator PowerShell window. The quoted paths let Service Control Manager launch the binary from Program Files. The default service account is LocalSystem.
New-Service -Name 'logship.agent' -DisplayName 'Logship Agent' -StartupType Automatic -BinaryPathName ('"{0}" --contentRoot "{1}"' -f $exe, $install)
Start-Service logship.agent
Get-Service logship.agentCheck for Running and a disk record newer than the service start. Run Restart-Service logship.agent, wait at least one collection interval and repeat the query. The same approved host should produce a newer timestamp. Continue to the disk dashboard and alert.
If the service exits, inspect its PathName and StartName with the first command. Check that this identity can read the installed config and write the configured state directory. With the service stopped, run the installed executable in the foreground using the same content root to see configuration and connection errors. For an empty result, check the receiving account, approval state, machine filter and backend readiness.
Upgrade an existing service
Read the current service path, content root, service identity and configured Output.dataPath before stopping it. Keep the service registration. Download the matching architecture into a new staging directory, expand the new ZIP there, and confirm the executable is present. Stop the service and securely back up the installation, configuration and state directory. Copy the staged release files to the installation, excluding appsettings.json and any site configuration or state files. Keep the existing directory permissions. Start the service, check for a new disk record and confirm that the receiving account still shows the same approval. If startup fails, inspect the foreground error before changing enrollment.