@@ -110,18 +110,38 @@ $arch = "amd64"
110
110
$format = " msi"
111
111
$service_name = " splunk-otel-collector"
112
112
$signalfx_dl = " https://dl.signalfx.com"
113
- $installation_path = " \Program Files"
114
- $program_data_path = " \ProgramData\Splunk\OpenTelemetry Collector"
113
+ try {
114
+ Resolve-Path $env: PROGRAMFILES
115
+ $installation_path = " ${env: PROGRAMFILES} \Splunk\OpenTelemetry Collector"
116
+ } catch {
117
+ $installation_path = " \Program Files\Splunk\OpenTelemetry Collector"
118
+ }
119
+ try {
120
+ Resolve-Path $env: PROGRAMDATA
121
+ $program_data_path = " ${env: PROGRAMDATA} \Splunk\OpenTelemetry Collector"
122
+ } catch {
123
+ $program_data_path = " \ProgramData\Splunk\OpenTelemetry Collector"
124
+ }
115
125
$old_config_path = " $program_data_path \config.yaml"
116
126
$agent_config_path = " $program_data_path \agent_config.yaml"
117
127
$gateway_config_path = " $program_data_path \gateway_config.yaml"
118
128
$config_path = " "
119
- $tempdir = " \tmp\Splunk\OpenTelemetry Collector"
129
+ try {
130
+ Resolve-Path $env: TEMP
131
+ $tempdir = " ${env: TEMP} \Splunk\OpenTelemetry Collector"
132
+ } catch {
133
+ $tempdir = " \tmp\Splunk\OpenTelemetry Collector"
134
+ }
120
135
$regkey = " HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment"
121
136
122
- $fluentd_msi_name = " td-agent-4.0.1 -x64.msi"
137
+ $fluentd_msi_name = " td-agent-4.1.0 -x64.msi"
123
138
$fluentd_dl_url = " https://packages.treasuredata.com/4/windows/$fluentd_msi_name "
124
- $fluentd_base_dir = " \opt\td-agent"
139
+ try {
140
+ Resolve-Path $env: SYSTEMDRIVE
141
+ $fluentd_base_dir = " ${env: SYSTEMDRIVE} \opt\td-agent"
142
+ } catch {
143
+ $fluentd_base_dir = " \opt\td-agent"
144
+ }
125
145
$fluentd_config_dir = " $fluentd_base_dir \etc\td-agent"
126
146
$fluentd_config_path = " $fluentd_config_dir \td-agent.conf"
127
147
$fluentd_service_name = " fluentdwinsvc"
@@ -365,7 +385,7 @@ if ($hec_token -eq "") {
365
385
}
366
386
367
387
if ($bundle_dir -eq " " ) {
368
- $bundle_dir = " C:\Program Files\Splunk\OpenTelemetry Collector \agent-bundle"
388
+ $bundle_dir = " $installation_path \agent-bundle"
369
389
}
370
390
371
391
if (" $env: VERIFY_ACCESS_TOKEN " -ne " false" ) {
@@ -408,20 +428,20 @@ echo "- Done"
408
428
409
429
# copy the default configs to $program_data_path
410
430
mkdir " $program_data_path " - ErrorAction Ignore
411
- if (! (Test-Path - Path " $agent_config_path " ) -And (Test-Path - Path " $installation_path \Splunk\OpenTelemetry Collector\ agent_config.yaml" )) {
431
+ if (! (Test-Path - Path " $agent_config_path " ) -And (Test-Path - Path " $installation_path \agent_config.yaml" )) {
412
432
echo " $agent_config_path not found"
413
433
echo " Copying default agent_config.yaml to $agent_config_path "
414
- Copy-Item " $installation_path \Splunk\OpenTelemetry Collector\ agent_config.yaml" " $agent_config_path "
434
+ Copy-Item " $installation_path \agent_config.yaml" " $agent_config_path "
415
435
}
416
- if (! (Test-Path - Path " $gateway_config_path " ) -And (Test-Path - Path " $installation_path \Splunk\OpenTelemetry Collector\ gateway_config.yaml" )) {
436
+ if (! (Test-Path - Path " $gateway_config_path " ) -And (Test-Path - Path " $installation_path \gateway_config.yaml" )) {
417
437
echo " $gateway_config_path not found"
418
438
echo " Copying default gateway_config.yaml to $gateway_config_path "
419
- Copy-Item " $installation_path \Splunk\OpenTelemetry Collector\ gateway_config.yaml" " $gateway_config_path "
439
+ Copy-Item " $installation_path \gateway_config.yaml" " $gateway_config_path "
420
440
}
421
- if (! (Test-Path - Path " $old_config_path " ) -And (Test-Path - Path " $installation_path \Splunk\OpenTelemetry Collector\ config.yaml" )) {
441
+ if (! (Test-Path - Path " $old_config_path " ) -And (Test-Path - Path " $installation_path \config.yaml" )) {
422
442
echo " $old_config_path not found"
423
443
echo " Copying default config.yaml to $old_config_path "
424
- Copy-Item " $installation_path \Splunk\OpenTelemetry Collector\ config.yaml" " $old_config_path "
444
+ Copy-Item " $installation_path \config.yaml" " $old_config_path "
425
445
}
426
446
427
447
if (($mode -Eq " agent" ) -And (Test-Path - Path " $agent_config_path " )) {
@@ -454,8 +474,8 @@ start_service -name "$service_name" -config_path "$config_path"
454
474
echo " - Started"
455
475
456
476
if ($with_fluentd ) {
457
- $default_fluentd_config = " $installation_path \Splunk\OpenTelemetry Collector\ fluentd\td-agent.conf"
458
- $default_confd_dir = " $installation_path \Splunk\OpenTelemetry Collector\ fluentd\conf.d"
477
+ $default_fluentd_config = " $installation_path \fluentd\td-agent.conf"
478
+ $default_confd_dir = " $installation_path \fluentd\conf.d"
459
479
460
480
# copy the default fluentd config to $fluentd_config_path if it does not already exist
461
481
if (! (Test-Path - Path " $fluentd_config_path " ) -And (Test-Path - Path " $default_fluentd_config " )) {
@@ -503,7 +523,8 @@ Make sure that your system's time is relatively accurate or else datapoints may
503
523
The collector's main configuration file is located at $config_path ,
504
524
and the environment variables are stored in the $regkey registry key.
505
525
506
- If the $config_path or any of the SPLUNK_* environment variables in $regkey are modified,
526
+ If the $config_path configuration file or any of the
527
+ SPLUNK_* environment variables in the $regkey registry key are modified,
507
528
the collector service must be restarted to apply the changes by restarting the system or running the
508
529
following PowerShell commands:
509
530
PS> Stop-Service $service_name
0 commit comments