OAuth2 Client Authエクステンション

このエクステンションは、HTTPおよびgRPCベースのエクスポーター用のOAuth2クライアント認証情報フローを提供します。

oauth2client エクステンションは、HTTP および gRPC ベースのエクスポータ用の OAuth2 クライアントログイン情報フロー認証を提供します。このエクステンションは、トークンの有効期限が切れた後、自動的にトークンを取得して更新します。

OAuth2 ログイン情報フロー(2 レッグワークフロー)の詳細については、OAuth 2.0 認証フレームワーク仕様の「Client Credentials Grant」を参照してください。

利用可能なエクスポータについては「Collector コンポーネント:エクスポータ」を参照してください。

はじめに

以下の手順に従って、コンポーネントの設定とアクティベーションを行ってください:

  1. Splunk Distribution of the OpenTelemetry Collector をホストまたはコンテナプラットフォームにデプロイします:

  2. 次のセクションで説明するように、エクステンションを設定します。

  3. Collector を再起動します。

サンプル構成

コンポーネントをアクティブにするには、設定ファイルのextensions セクションに oauth2client を追加します:

YAML
extensions:
  oauth2client:

設定を完了するには、設定ファイルの service セクションに拡張子を含めます:

YAML
service:
  extensions: [oauth2client]
注: OAuth2 Client Auth エクステンションを使用して、エクスポータでオーセンティケータタイプを oauth2client に設定します。「設定例」を参照してください。

コンフィギュレーション設定

エクステンションの設定には以下の設定が必要です:

  • token_urlします。リソースサーバーのトークンエンドポイント URL。

  • client_idします。クライアントに発行されたクライアント識別子。

  • client_id_fileします。クライアントに発行されたクライアント識別子を取得するためのファイルパス。エクステンションはこのファイルを読み込み、新しいトークンを発行する必要があるときにクライアント ID を更新します。

    • このパラメータを使用すると、トークンをローテーションする必要がある場合などに、ファイルの内容を修正することでクライアントの認証情報を動的に変更することができます。

    • この設定は client_id よりも優先されます。

  • client_secretします。識別子に関連付けられたシークレット文字列。

  • client_secret_fileします。識別子に関連付けられたシークレット文字列を取得するためのファイルパス。エクステンションはこのファイルを読み込み、新しいトークンを発行する必要があるときにクライアントシークレットを更新します。

    • このパラメータにより、例えばトークンをローテーションする必要がある場合に、ファイルの内容を修正することでクライアントの認証情報を動的に変更することができます。

    • この設定は client_secret よりも優先されます。

  • endpoint_paramsします。トークンのエンドポイントに送信される追加パラメータ。

  • scopesします。オプション。クライアントに関連付けられた要求されたアクセス許可。

  • timeoutします。オプション。認証サーバーがトークンを取得するための基礎となるクライアントのタイムアウトを、初期と更新中の両方に指定します。

    • 無効の場合、クライアントにタイムアウトはありません。

クライアント側 TLS 設定に関する情報は「TLS を設定する」を参照してください。

設定例

これはエクステンションの設定例です:

YAML
extensions:
  oauth2client:
    client_id: someclientid
    client_secret: someclientsecret
    endpoint_params:
      audience: someaudience
    token_url: https://example.com/oauth2/default/v1/token
    scopes: ["api.metrics"]
    # tls settings for the token client
    tls:
      insecure: true
      ca_file: /var/lib/mycert.pem
      cert_file: certfile
      key_file: keyfile
    # timeout for the token client
    timeout: 2s

receivers:
  hostmetrics:
    scrapers:
      memory:
  otlp:
    protocols:
      grpc:

exporters:
  otlphttp/withauth:
    endpoint: http://localhost:9000
    auth:
      authenticator: oauth2client

  otlp/withauth:
    endpoint: 0.0.0.0:5000
    tls:
      ca_file: /tmp/certs/ca.pem
    auth:
      authenticator: oauth2client

service:
  extensions: [oauth2client]
  pipelines:
    metrics:
      receivers: [hostmetrics]
      processors: []
      exporters: [otlphttp/withauth, otlp/withauth]

設定

次の表は、oauth2client エクステンションの設定オプションを示しています:

同梱

https://raw.githubusercontent.com/splunk/collector-config-tools/main/cfg-metadata/extension/oauth2client.yaml

トラブルシューティング

If you are a Splunk Observability Cloud customer and are not able to see your data in Splunk Observability Cloud, you can get help in the following ways.

Available to Splunk Observability Cloud customers

Available to prospective customers and free trial users

  • Ask a question and get answers through community support at Splunk Answers.

  • Join the Splunk community #observability Slack channel to communicate with customers, partners, and Splunk employees worldwide.