-
Notifications
You must be signed in to change notification settings - Fork 147
/
splunk-otel-collector.wxs
154 lines (139 loc) · 9.49 KB
/
splunk-otel-collector.wxs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="24E519F6-7F01-43DB-9E72-3B8AD8F065F4" UpgradeCode="fde3e4d9-9ca5-4c82-be7b-81445ab5b605" Name="Splunk OpenTelemetry Collector" Version="$(var.Version)" Manufacturer="Splunk, Inc." Language="1033">
<Package InstallerVersion="200" Compressed="yes" Comments="Windows Installer Package" InstallPrivileges="elevated" InstallScope="perMachine" />
<Media Id="1" Cabinet="product.cab" EmbedCab="yes"/>
<Icon Id="ProductIcon" SourceFile="$(sys.SOURCEFILEDIR)/splunk.ico"/>
<Property Id="ARPPRODUCTICON" Value="ProductIcon"/>
<Property Id="ARPHELPLINK" Value="https://splunk.com/"/>
<Property Id="ARPURLINFOABOUT" Value="https://splunk.com/"/>
<Property Id="ARPNOREPAIR" Value="1"/>
<Property Id="ARPNOMODIFY" Value="1"/>
<!-- Load the Splunk custom actions -->
<Binary Id="SplunkCustomActionsDll" SourceFile="$(sys.SOURCEFILEDIR)/SplunkCustomActions/bin/Release/SplunkCustomActions.CA.dll" />
<CustomAction Id="CheckLaunchConditions" DllEntry="CheckLaunchConditions" BinaryKey="SplunkCustomActionsDll" Execute="immediate" />
<CustomAction
Id="AddOptionalConfigurationsCustomActionData"
Property="AddOptionalConfigurations"
Value="GOMEMLIMIT=[GOMEMLIMIT];SPLUNK_COLLECTD_DIR=[SPLUNK_COLLECTD_DIR];SPLUNK_GATEWAY_URL=[SPLUNK_GATEWAY_URL];SPLUNK_LISTEN_INTERFACE=[SPLUNK_LISTEN_INTERFACE];SPLUNK_MEMORY_LIMIT_MIB=[SPLUNK_MEMORY_LIMIT_MIB];SPLUNK_MEMORY_TOTAL_MIB=[SPLUNK_MEMORY_TOTAL_MIB]" />
<CustomAction
Id="AddOptionalConfigurations"
DllEntry="AddOptionalConfigurations"
BinaryKey="SplunkCustomActionsDll"
Execute="deferred"
Impersonate="no" />
<!-- SPLUNK setup control properties -->
<Property Id="SPLUNK_SETUP_COLLECTOR_MODE" Value="agent" Secure="yes" />
<!-- SPLUNK token properties -->
<Property Id="SPLUNK_ACCESS_TOKEN" Secure="yes" />
<Property Id="SPLUNK_HEC_TOKEN" Secure="yes" />
<CustomAction Id="Set_SPLUNK_HEC_TOKEN" Property="SPLUNK_HEC_TOKEN" Value="[SPLUNK_ACCESS_TOKEN]"/>
<!-- SPLUNK_*_URL properties required to start the collector -->
<Property Id="SPLUNK_REALM" Value="us0" Secure="yes" />
<Property Id="SPLUNK_CONFIG" Secure="yes" />
<Property Id="SPLUNK_API_URL" Secure="yes" />
<Property Id="SPLUNK_INGEST_URL" Secure="yes" />
<Property Id="SPLUNK_HEC_URL" Secure="yes" />
<Property Id="SPLUNK_TRACE_URL" Secure="yes" />
<Property Id="SPLUNK_BUNDLE_DIR" Secure="yes" />
<CustomAction Id="Set_SPLUNK_CONFIG" Property="SPLUNK_CONFIG" Value="[CommonAppDataFolder]Splunk\OpenTelemetry Collector\[SPLUNK_SETUP_COLLECTOR_MODE]_config.yaml" />
<CustomAction Id="Set_SPLUNK_API_URL" Property="SPLUNK_API_URL" Value="https://api.[SPLUNK_REALM].signalfx.com"/>
<CustomAction Id="Set_SPLUNK_INGEST_URL" Property="SPLUNK_INGEST_URL" Value="https://ingest.[SPLUNK_REALM].signalfx.com"/>
<CustomAction Id="Set_SPLUNK_HEC_URL" Property="SPLUNK_HEC_URL" Value="[SPLUNK_INGEST_URL]/v1/log"/>
<CustomAction Id="Set_SPLUNK_TRACE_URL" Property="SPLUNK_TRACE_URL" Value="[SPLUNK_INGEST_URL]/v2/trace"/>
<CustomAction Id="Set_SPLUNK_BUNDLE_DIR" Property="SPLUNK_BUNDLE_DIR" Value="[INSTALLDIR]agent-bundle" />
<InstallExecuteSequence>
<Custom Action="CheckLaunchConditions" After="LaunchConditions" />
<Custom Action="Set_SPLUNK_HEC_TOKEN" After="LaunchConditions">NOT SPLUNK_HEC_TOKEN</Custom>
<Custom Action="Set_SPLUNK_CONFIG" After="LaunchConditions">NOT SPLUNK_CONFIG</Custom>
<Custom Action="Set_SPLUNK_API_URL" After="LaunchConditions">NOT SPLUNK_API_URL</Custom>
<Custom Action="Set_SPLUNK_INGEST_URL" After="LaunchConditions">NOT SPLUNK_INGEST_URL</Custom>
<!-- The properties below depend on another properties and should be run only after all other properties are set -->
<Custom Action="Set_SPLUNK_HEC_URL" After="CostFinalize">NOT SPLUNK_HEC_URL</Custom>
<Custom Action="Set_SPLUNK_TRACE_URL" After="CostFinalize">NOT SPLUNK_TRACE_URL</Custom>
<Custom Action="Set_SPLUNK_BUNDLE_DIR" After="CostFinalize">NOT SPLUNK_BUNDLE_DIR</Custom>
<!-- After files installation the registry is set for the service, check optional configurations -->
<Custom Action="AddOptionalConfigurationsCustomActionData" Before="AddOptionalConfigurations" />
<Custom Action="AddOptionalConfigurations" After="WriteRegistryValues" />
</InstallExecuteSequence>
<MajorUpgrade DowngradeErrorMessage="A later version of the Splunk OpenTelemetry Collector is already installed. Setup will now exit."/>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFiles64Folder">
<Directory Id="COMPANYDIR" Name="Splunk">
<Directory Id="INSTALLDIR" Name="OpenTelemetry Collector">
<Component Id="ApplicationComponent" Guid="484fa99a-2efe-41cd-a047-98bc1fc71e04">
<File Id="OtelcolExecutableFile" Name="otelcol.exe" KeyPath="yes" Source="$(var.Otelcol)"/>
<ServiceInstall
Id="Service"
Name="splunk-otel-collector"
DisplayName="Splunk OpenTelemetry Collector"
Description="Splunk OpenTelemetry Collector"
Type="ownProcess"
Vital="yes"
Start="auto"
Account="LocalSystem"
ErrorControl="normal"
Interactive="no" />
<ServiceControl
Id="StartStopRemoveService"
Name="splunk-otel-collector"
Stop="both"
Remove="uninstall"
Wait="yes" />
</Component>
</Directory>
</Directory>
</Directory>
<Directory Id="OptDir" Name="opt">
<Component Id="JmxMetricsJarComponent" Guid="c2aca15f-813a-4497-9bad-1c97e7bff618">
<File Id="JmxMetricsJar" Name="opentelemetry-java-contrib-jmx-metrics.jar" KeyPath="yes" Source="$(var.JmxMetricsJar)"/>
</Component>
</Directory>
</Directory>
<Component Id="RegistryComponent" Guid="8d6d2a92-9952-4251-8f6b-d85c5b2182e4" Directory="INSTALLDIR">
<Condition>NOT Installed OR REINSTALL</Condition>
<RegistryKey Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\EventLog\Application\splunk-otel-collector">
<RegistryValue Type="expandable" Name="EventMessageFile" Value="%SystemRoot%\System32\EventCreate.exe"/>
</RegistryKey>
<RegistryKey Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\splunk-otel-collector">
<RegistryValue Type="multiString" Name="Environment">
<MultiStringValue>SPLUNK_ACCESS_TOKEN=[SPLUNK_ACCESS_TOKEN]</MultiStringValue>
<MultiStringValue>SPLUNK_API_URL=[SPLUNK_API_URL]</MultiStringValue>
<MultiStringValue>SPLUNK_BUNDLE_DIR=[SPLUNK_BUNDLE_DIR]</MultiStringValue>
<MultiStringValue>SPLUNK_CONFIG=[SPLUNK_CONFIG]</MultiStringValue>
<MultiStringValue>SPLUNK_HEC_TOKEN=[SPLUNK_HEC_TOKEN]</MultiStringValue>
<MultiStringValue>SPLUNK_HEC_URL=[SPLUNK_HEC_URL]</MultiStringValue>
<MultiStringValue>SPLUNK_INGEST_URL=[SPLUNK_INGEST_URL]</MultiStringValue>
<MultiStringValue>SPLUNK_REALM=[SPLUNK_REALM]</MultiStringValue>
<MultiStringValue>SPLUNK_TRACE_URL=[SPLUNK_TRACE_URL]</MultiStringValue>
</RegistryValue>
</RegistryKey>
</Component>
<Feature Id="SplunkOtelCollector" Level="1">
<ComponentRef Id="ApplicationComponent"/>
<Feature Id="SplunkCollectorConfiguration" Level="1">
<ComponentRef Id="RegistryComponent"/>
</Feature>
<ComponentRef Id="RegistryComponent"/>
<ComponentRef Id="JmxMetricsJarComponent"/>
<!-- list of config files auto-generated by heat at build time -->
<ComponentGroupRef Id="ConfigFiles"/>
</Feature>
<!-- Check if the config file already exists in ProgramData -->
<Property Id="CONFIG_FILE_EXISTS">
<DirectorySearch Id="AppDataFolderSearch" Path="[CommonAppDataFolder]">
<DirectorySearch Id="SplunkSearch" Path="Splunk">
<DirectorySearch Id="OpenTelemetryCollectorSearch" Path="OpenTelemetry Collector">
<FileSearch Id="ConfigSearch" Name="agent_config.yaml" />
</DirectorySearch>
</DirectorySearch>
</DirectorySearch>
</Property>
<!-- Copy the default agent config file to ProgramData if it does not already exist -->
<CustomAction Id="CopyConfig" ExeCommand="xcopy /y "[INSTALLDIR]*_config.yaml" "[CommonAppDataFolder]Splunk\OpenTelemetry Collector\"" Directory="INSTALLDIR" Impersonate="no" Execute="deferred" Return="check" />
<CustomAction Id="DeleteProgramFilesConfig" ExeCommand="cmd /c del /q "[INSTALLDIR]*config.yaml"" Directory="INSTALLDIR" Impersonate="no" Execute="deferred" Return="ignore" />
<InstallExecuteSequence>
<Custom Action="CopyConfig" After="InstallFiles">NOT CONFIG_FILE_EXISTS AND NOT Installed</Custom>
<Custom Action="DeleteProgramFilesConfig" After="CopyConfig"/>
</InstallExecuteSequence>
</Product>
</Wix>