-
Notifications
You must be signed in to change notification settings - Fork 5k
Open
Labels
Team:Elastic-Agent-Data-PlaneLabel for the Agent Data Plane teamLabel for the Agent Data Plane teambug
Description
When a beat is installed following the zip docs on a Windows system that has an older beat (<8.19) version installed, it migrates the old data dir but places it in the wrong location, causing the new beat instance to start with a fresh registry instead of reusing the migrated one.
For confirmed bugs, please report:
- Version: Filebeat 8.19, 9.x, should affect any beat
- Operating System:
Windows 11 25H2,PowerShell 5.1.26100 and 6.2.3
Steps to Reproduce:
- Download a Filebeat 8.15 windows zip and run
.\install-service-filebeat.ps1andStart-Service filebeat. - Verify that the data files exist at
C:\ProgramData\Filebeat. - Download a Filebeat 9.2.2 windows zip and run
.\install-service-filebeat.ps1. - The migrated files from the old Filebeat installation were placed in
C:\Program Files\Filebeat-Data, one directory too high. They should have been placed inside theFilebeatsubdirectory.
├── Filebeat-Data
│ ├── Filebeat
│ │ ├── filebeat.lock
│ │ ├── logs
│ │ ├── meta.json
│ │ └── registry
│ ├── filebeat.lock
│ ├── logs
│ ├── meta.json
│ └── registry
From my debugging session, changing the installation script seems to fix the issue:
diff --git a/dev-tools/packaging/templates/windows/install-service.ps1.tmpl b/dev-tools/packaging/templates/windows/install-service.ps1.tmpl
index 9dd27e2dd1..100f209041 100644
--- a/dev-tools/packaging/templates/windows/install-service.ps1.tmpl
+++ b/dev-tools/packaging/templates/windows/install-service.ps1.tmpl
@@ -46,7 +46,10 @@ If ($ForceLegacyPath -eq $True) {
} elseif (Test-Path $LegacyDataPath) {
Write-Output "Files found at $LegacyDataPath, moving them to $BasePath"
Try {
- Move-Item $LegacyDataPath $BasePath -ErrorAction Stop
+ if (-not (Test-Path $BasePath)) {
+ New-Item -ItemType Directory -Path $BasePath -ErrorAction Stop
+ }
+ Move-Item $LegacyDataPath "$BasePath\Filebeat" -Force -ErrorAction Stop
} Catch {
Write-Output "Could not move $LegacyDataPath to $BasePath"
Write-Output "make sure the folder can be moved or set -ForceLegacyPath"Related issues:
- Original PR with the migration changes and more detailed instructions Update base path for Beats installation on Windows #43995
Metadata
Metadata
Assignees
Labels
Team:Elastic-Agent-Data-PlaneLabel for the Agent Data Plane teamLabel for the Agent Data Plane teambug