Skip to content

Commit

Permalink
Add helper allow running the collector manually on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
pjanotti committed Nov 27, 2023
1 parent fe6a0ce commit e091ad7
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions internal/buildscripts/packaging/msi/splunk-support-bundle.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,23 @@ for ( $i = 0; $i -lt $args.count; $i++ ) {
}
}

#######################################
# Extracts the environment variables configured for the splunk-otel-collector service
# and sets them in the current PowerShell session. This is useful to directly run the
# collector from the PowerShell console. This is not required for the support bundle.
# - GLOBALS: None
# - ARGUMENTS: None
# - OUTPUTS: None
# - RETURN: None
#######################################
function setCurrentEnvironmentForManualRun() {
$env_array = Get-ItemPropertyValue -Path "HKLM:\SYSTEM\CurrentControlSet\Services\splunk-otel-collector" -Name "Environment"
foreach ($entry in $env_array) {
$key, $value = $entry.Split("=", 2)
[Environment]::SetEnvironmentVariable($key, $value)
}
}

#######################################
# Creates a unique temporary directory to store the contents of the support
# bundle. Do not attempt to cleanup to prevent any accidental deletions.
Expand Down

0 comments on commit e091ad7

Please sign in to comment.