Collector for Windows を手動でインストールする

Splunk Distribution of the OpenTelemetry Collector for Windowsを手動でインストールする方法について説明します。

Windows MSIを使用してSplunk Distribution of the Collector for Windowsをインストールできます。

注: Splunk Distribution of the OpenTelemetry Collector にはデフォルト設定が付属しています。詳しくは「Collector for Windows default configuration」をご確認ください。この設定を変更するには、「Windowsの詳細設定」を参照してください。ログを取得するには、「Windowsの Collector を使用したログの収集」を参照してください。

または、Collector for Windowsをインストールすることもできます。

前提条件

Dockerを使用してCollector for Windowsをインストールする

以下のコマンドを実行して、最新のDockerイメージをデプロイします:

POWERSHELL
$ docker run --rm -e SPLUNK_ACCESS_TOKEN=12345 -e SPLUNK_REALM=us0  `
          -p 13133:13133 -p 14250:14250 -p 14268:14268 -p 4317:4317 -p 6060:6060  `
          -p 8888:8888 -p 9080:9080 -p 9411:9411 -p 9943:9943 `
          --name=otelcol quay.io/signalfx/splunk-otel-collector-windows:latest

バイナリファイルを使用してCollector for Windowsをインストールする

バイナリファイルを使用して Collector をインストールするには、以下の手順に従います:

  1. GitHub リリースから、お使いのアーキテクチャのバイナリをダウンロードしてください。

  2. 既存の設定ファイルまたはカスタム設定ファイルを使用していない場合は、Collector 用のデフォルト設定ファイル <https://github.com/signalfx/splunk-otel-collector/tree/main/cmd/otelcol/config/collector> をダウンロードしてください。詳しくは「Collector for Windows のデフォルト設定」をご確認ください。

  3. コマンドラインからバイナリを実行します:

POWERSHELL
# see available command-line options
PS> & '<download dir>\otelcol_windows_amd64.exe' --help
Usage of otelcol:
    --config string          Locations to the config file(s), note that only a single location can be set per flag entry e.g. --config=/path/to/first --config=path/to/second. (default "[]")
    --feature-gates string   Comma-delimited list of feature gate identifiers. Prefix with '-' to disable the feature. '+' or no prefix will enable the feature. (default "[]")
    --no-convert-config      Do not translate old configurations to the new format automatically. By default, old configurations are translated to the new format for backward compatibility.
    --set string             Set arbitrary component config property. The component has to be defined in the config file and the flag has a higher precedence. Array config properties are overridden and maps are joined. Example --set=processors.batch.timeout=2s (default "[]")
    -v, --version                Version of the collector.

# set the SPLUNK_REALM and SPLUNK_ACCESS_TOKEN env vars required in our default config files
PS> $env:SPLUNK_REALM = "<realm>"
PS> $env:SPLUNK_ACCESS_TOKEN = "<token>"

# start the collector
PS> & '<download dir>\otelcol_windows_amd64.exe' --config=<path to config file>

# alternatively, use the SPLUNK_CONFIG env var instead of the --config command-line option
PS> $env:SPLUNK_CONFIG = "<path to config file>"
PS> & '<download dir>\otelcol_windows_amd64.exe'

# type Ctrl-c to stop the collector

カスタム設定ファイルを使用する

カスタム構成ファイルを使用する場合は、そのファイルを含むディレクトリをマウントし、SPLUNK_CONFIG=<path>環境変数または --config=<path> コマンドライン引数を使用します。 <path> をコンテナ内のカスタムファイルへのパスに置き換えます。

構成ファイルをWindowsコンテナにマウントするには、構成ファイルが存在するディレクトリ名を指定します。

SPLUNK_CONFIG を使用した例

SPLUNK_CONFIG SPLUNK_CONFIG
POWERSHELL
$ docker run --rm -e SPLUNK_ACCESS_TOKEN=12345 -e SPLUNK_REALM=us0 `
          -e SPLUNK_CONFIG=c:\splunk_config\gateway_config.yaml -p 13133:13133  `
          -p 14250:14250 -p 14268:14268 -p 4317:4317 -p 6060:6060 -p 8888:8888 -p 9080:9080 `
          -p 9411:9411 -p 9943:9943 -v ${PWD}\splunk_config:c:\splunk_config:RO `
          --name otelcol quay.io/signalfx/splunk-otel-collector-windows:latest

--config を使用した例

--config --config
POWERSHELL
$ docker run --rm -e SPLUNK_ACCESS_TOKEN=12345 -e SPLUNK_REALM=us0 `
    -p 13133:13133 -p 14250:14250 -p 14268:14268 -p 4317:4317 -p 6060:6060 `
    -p 8888:8888 -p 9080:9080 -p 9411:9411 -p 9943:9943 `
    -v ${PWD}\splunk_config:c:\splunk_config:RO `
    --name otelcol quay.io/signalfx/splunk-otel-collector-windows:latest `
    --config c:\splunk_config\gateway_config.yaml

次のステップ