Skip to content

Commit 55dc82a

Browse files
committed
Release v1.3.1 single router log cleanup
1 parent 0a92575 commit 55dc82a

5 files changed

Lines changed: 92 additions & 13 deletions

File tree

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# Changelog
22

3+
## v1.3.1 - 2026-05-16
4+
5+
Router log cleanup release.
6+
7+
### Changed
8+
9+
- Router traffic in the selected log folder now goes to one fixed log file: `router-current.log`.
10+
- Legacy `sources` logs are merged into the single router log during layout migration.
11+
- Legacy `server` logs are moved into the internal runtime diagnostics area under `C:\ProgramData\GW-Router-Logger\diagnostics\listener-runtime`.
12+
- Tray self-test no longer recreates `sources` and `server` inside the chosen router log folder.
13+
314
## v1.3.0 - 2026-05-16
415

516
Single-entrypoint tray integration release.

GW-Router-Logger.TrayMode.psm1

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
# installs only expose one app script to the user.
44

55
$script:AppName = 'GW Router Logger'
6-
$script:Version = '1.3.0'
6+
$script:Version = '1.3.1'
77
$script:Publisher = 'Ghostwheel'
88
$script:GitHubOwner = 'GhostwheeI'
99
$script:GitHubRepo = 'GW-Router-Logger'
1010
$script:DefaultUdpPort = 514
1111
$script:DefaultTcpPort = 514
1212
$script:DefaultTcpEnabled = $false
13+
$script:RouterLogBaseName = 'router-current'
1314
$script:ActiveLogRotateBytes = 5MB
1415
$script:ActiveLogRotateMinutes = 60
1516
$script:MaxCompressedBytes = 100MB
@@ -723,6 +724,40 @@ function Move-DirectoryContents {
723724
}
724725
}
725726

727+
function Merge-TextFileIntoPath {
728+
param(
729+
[Parameter(Mandatory = $true)] [string] $SourcePath,
730+
[Parameter(Mandatory = $true)] [string] $DestinationPath
731+
)
732+
733+
if (-not (Test-Path -LiteralPath $SourcePath)) {
734+
return
735+
}
736+
737+
if ([IO.Path]::GetFullPath($SourcePath).TrimEnd('\') -eq [IO.Path]::GetFullPath($DestinationPath).TrimEnd('\')) {
738+
return
739+
}
740+
741+
$destinationDirectory = Split-Path -Path $DestinationPath -Parent
742+
Ensure-Directory -Path $destinationDirectory | Out-Null
743+
744+
if (-not (Test-Path -LiteralPath $DestinationPath)) {
745+
Move-Item -LiteralPath $SourcePath -Destination $DestinationPath -Force -ErrorAction SilentlyContinue
746+
return
747+
}
748+
749+
$sourceContent = Get-Content -LiteralPath $SourcePath -Raw -ErrorAction SilentlyContinue
750+
if (-not [string]::IsNullOrEmpty($sourceContent)) {
751+
$destinationHasContent = ((Get-Item -LiteralPath $DestinationPath -ErrorAction SilentlyContinue).Length -gt 0)
752+
if ($destinationHasContent) {
753+
Add-Content -LiteralPath $DestinationPath -Value '' -Encoding UTF8
754+
}
755+
Add-Content -LiteralPath $DestinationPath -Value $sourceContent -Encoding UTF8
756+
}
757+
758+
Remove-Item -LiteralPath $SourcePath -Force -ErrorAction SilentlyContinue
759+
}
760+
726761
function Remove-DirectoryIfEmpty {
727762
param([string] $Path)
728763

@@ -757,7 +792,7 @@ function Resolve-LogLayout {
757792
if (Test-Path -LiteralPath $legacySourceRoot) {
758793
$sourceFiles = @(Get-ChildItem -LiteralPath $legacySourceRoot -Force -File -ErrorAction SilentlyContinue)
759794
foreach ($file in $sourceFiles) {
760-
Move-Item -LiteralPath $file.FullName -Destination (Join-Path -Path $Settings.SourceLogRoot -ChildPath $file.Name) -Force -ErrorAction SilentlyContinue
795+
Merge-TextFileIntoPath -SourcePath $file.FullName -DestinationPath (Join-Path -Path $Settings.SourceLogRoot -ChildPath ($script:RouterLogBaseName + '.log'))
761796
}
762797
}
763798
if (Test-Path -LiteralPath $legacyServerArchiveRoot) {
@@ -1078,7 +1113,7 @@ function New-ListenerScriptBlock {
10781113
$archiveRoot = Join-Path -Path $Settings.RuntimeLogRoot -ChildPath 'archive'
10791114
}
10801115
else {
1081-
$targetPath = Get-SafeLogPath -Directory $Settings.SourceLogRoot -BaseName ($SourceName + '-current') -Suffix '.log'
1116+
$targetPath = Get-SafeLogPath -Directory $Settings.SourceLogRoot -BaseName $script:RouterLogBaseName -Suffix '.log'
10821117
$archiveRoot = Join-Path -Path $Settings.LogRoot -ChildPath 'archive'
10831118
}
10841119

@@ -1935,9 +1970,7 @@ function Build-ContextMenu {
19351970

19361971
function Invoke-SelfTest {
19371972
$config = Get-AppConfig
1938-
Ensure-Directory -Path $config.LogRoot | Out-Null
1939-
Ensure-Directory -Path (Join-Path -Path $config.LogRoot -ChildPath 'sources') | Out-Null
1940-
Ensure-Directory -Path (Join-Path -Path $config.LogRoot -ChildPath 'server') | Out-Null
1973+
Resolve-LogLayout -Settings $config
19411974
Write-AppLog -Message 'Self-test diagnostic log entry.' -Diagnostic
19421975
'SELFTEST_OK'
19431976
}

GW-Router-Logger.ps1

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,15 @@ catch {
2525
# These script-scoped values act as the main tuning points for future maintenance.
2626
# Keeping them together makes it easier to adjust behavior without searching the file.
2727
$script:AppName = 'GW Router Logger'
28-
$script:Version = '1.3.0'
28+
$script:Version = '1.3.1'
2929
$script:MaxCompressedBytes = 100MB
3030
$script:ActiveLogRotateBytes = 5MB
3131
$script:ActiveLogRotateMinutes = 60
3232
$script:RecentEventsMax = 12
3333
$script:StatusRefreshMilliseconds = 2000
3434
$script:DefaultUdpPort = 514
3535
$script:DefaultTcpPort = 514
36+
$script:RouterLogBaseName = 'router-current'
3637
$script:DefaultResolveHostNames = $false
3738
$script:DnsLookupTimeoutMilliseconds = 250
3839
$script:SourceNameCacheTtlMinutes = 30
@@ -254,6 +255,40 @@ function Move-DirectoryContents {
254255
}
255256
}
256257

258+
function Merge-TextFileIntoPath {
259+
param(
260+
[Parameter(Mandatory = $true)] [string] $SourcePath,
261+
[Parameter(Mandatory = $true)] [string] $DestinationPath
262+
)
263+
264+
if (-not (Test-Path -LiteralPath $SourcePath)) {
265+
return
266+
}
267+
268+
if ([IO.Path]::GetFullPath($SourcePath).TrimEnd('\') -eq [IO.Path]::GetFullPath($DestinationPath).TrimEnd('\')) {
269+
return
270+
}
271+
272+
$destinationDirectory = Split-Path -Path $DestinationPath -Parent
273+
Ensure-Directory -Path $destinationDirectory | Out-Null
274+
275+
if (-not (Test-Path -LiteralPath $DestinationPath)) {
276+
Move-Item -LiteralPath $SourcePath -Destination $DestinationPath -Force -ErrorAction SilentlyContinue
277+
return
278+
}
279+
280+
$sourceContent = Get-Content -LiteralPath $SourcePath -Raw -ErrorAction SilentlyContinue
281+
if (-not [string]::IsNullOrEmpty($sourceContent)) {
282+
$destinationHasContent = ((Get-Item -LiteralPath $DestinationPath -ErrorAction SilentlyContinue).Length -gt 0)
283+
if ($destinationHasContent) {
284+
Add-Content -LiteralPath $DestinationPath -Value '' -Encoding UTF8
285+
}
286+
Add-Content -LiteralPath $DestinationPath -Value $sourceContent -Encoding UTF8
287+
}
288+
289+
Remove-Item -LiteralPath $SourcePath -Force -ErrorAction SilentlyContinue
290+
}
291+
257292
function Remove-DirectoryIfEmpty {
258293
param([string] $Path)
259294

@@ -288,7 +323,7 @@ function Resolve-LogLayout {
288323
if (Test-Path -LiteralPath $legacySourceRoot) {
289324
$sourceFiles = @(Get-ChildItem -LiteralPath $legacySourceRoot -Force -File -ErrorAction SilentlyContinue)
290325
foreach ($file in $sourceFiles) {
291-
Move-Item -LiteralPath $file.FullName -Destination (Join-Path -Path $Settings.SourceLogRoot -ChildPath $file.Name) -Force -ErrorAction SilentlyContinue
326+
Merge-TextFileIntoPath -SourcePath $file.FullName -DestinationPath (Join-Path -Path $Settings.SourceLogRoot -ChildPath ($script:RouterLogBaseName + '.log'))
292327
}
293328
}
294329
if (Test-Path -LiteralPath $legacyServerArchiveRoot) {
@@ -851,7 +886,7 @@ function Write-LogRecord {
851886
$archiveRoot = Join-Path -Path $Settings.ServerLogRoot -ChildPath 'archive'
852887
}
853888
else {
854-
$targetPath = Get-SafeLogPath -Directory $Settings.SourceLogRoot -BaseName ($SourceName + '-current') -Suffix '.log'
889+
$targetPath = Get-SafeLogPath -Directory $Settings.SourceLogRoot -BaseName $script:RouterLogBaseName -Suffix '.log'
855890
$archiveRoot = Join-Path -Path $Settings.LogRoot -ChildPath 'archive'
856891
}
857892

Install-GWRouterLogger.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ param(
1212

1313
$ErrorActionPreference = 'Stop'
1414
$appName = 'GW Router Logger'
15-
$version = '1.3.0'
15+
$version = '1.3.1'
1616
$publisher = 'Ghostwheel'
1717

1818
function Test-IsAdministrator {

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
`GW Router Logger` is a PowerShell syslog collector for Windows, designed for home labs, residential routers, and small-network troubleshooting.
44

5-
Current release: `v1.3.0`
5+
Current release: `v1.3.1`
66

77
It focuses on the things that usually break first on normal Windows machines: elevation, pathing, firewall access, bind-address selection, log rollover, and clear on-screen status.
88

@@ -28,7 +28,7 @@ This script does the opposite. It guides setup, validates inputs, uses practical
2828
- Residential-friendly defaults: `UDP 514`, `TCP disabled`
2929
- Automatic suggestion of the local IPv4 address tied to the active default gateway
3030
- Live status dashboard with message counts, sender tracking, and recent events
31-
- Per-source log files plus a server/runtime log
31+
- One router log file in the selected log folder, with internal runtime logs kept separately
3232
- Rolling archive management with compression and a compressed retention cap
3333
- Cached, bounded hostname lookup so slow reverse DNS does not stall the listener
3434
- Stale TCP client cleanup for long-running sessions
@@ -113,7 +113,7 @@ The log folder you choose is now reserved for router-received logs. Internal run
113113

114114
```text
115115
GW-ROUTER-LOGS\
116-
192.168.50.1-current.log
116+
router-current.log
117117
archive\
118118
```
119119

0 commit comments

Comments
 (0)