Splunk HEC エクスポーター

Splunk HEC エクスポータにより、OpenTelemetry Collector はトレース、ログ、メトリクスを Splunk HTTP Event Collector(HEC)エンドポイントに送信できます。コンポーネントの設定方法については、続きをお読みください。

Splunk HTTP Event Collector(HEC)エクスポータにより、OpenTelemetry Collector はトレース、ログ、メトリクスを Splunk HEC エンドポイントに送信できます。サポートされるパイプラインタイプは、tracesmetricslogs です。詳細については「パイプラインでデータを処理する」を参照してください。

Splunk HEC エクスポータの主な目的は、ログとメトリクスを Splunk Cloud Platform または Splunk Enterprise に送信することです。Log Observer Connect を使用して、Splunk Cloud Platform および Splunk Enterprise のインデックスを Splunk Observability Cloud にプルするようになりました。詳細については、「Splunk Log Observer Connect」を参照してください。

エクスポータは、AlwaysOn Profiling データも Splunk Observability Cloud に送信します。詳細については、「Get data into Splunk APM AlwaysOn Profiling」を参照してください。

HEC レシーバーについて詳しくは「Splunk HEC receiver」を参照してください。

はじめに

注: このコンポーネントは、logs パイプラインにホスト監視(エージェント)モードでデプロイする場合、Splunk Distribution of the OpenTelemetry Collector のデフォルト設定に含まれます。詳細については、「Collector deployment modes」を参照してください。デフォルト設定について詳しくは「Helm で Collector for Kubernetes を設定する」、「Collector for Linux のデフォルト設定」、または「Collector for Windows のデフォルト設定」を参照してください。このドキュメントで説明されているように、いつでも設定をカスタマイズできます。

Splunk Distribution of OpenTelemetry Collector のバージョン 0.81 以降では、デフォルトの構成に、標準のログエクスポータとは別に AlwaysOn Profiling データ用のエクスポータが含まれています。「Turn off logs or profiling data」を参照してください。

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

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

  2. このドキュメントで説明されているように、エクスポーターを設定してください。

  3. Collector を再起動します。

サンプル構成

次の例は、Collector 設定ファイルでログパイプライン用に設定された Splunk HEC exporter インスタンスを示しています:

exporters:
  # ...
  splunk_hec:
    token: "<hec-token>"
    endpoint: "<hec-endpoint>"
    # Source. See https://docs.splunk.com/Splexicon:Source
    source: "otel"
    # Source type. See https://docs.splunk.com/Splexicon:Sourcetype
    sourcetype: "otel"

# ...

次に、設定ファイルの services セクションにエクスポーターを追加します:

service:
  # ...
  pipelines:
    logs:
      receivers: [fluentforward, otlp]
      processors:
      - memory_limiter
      - batch
      - resourcedetection
      exporters: [splunk_hec]

Splunk HEC トークンとエンドポイント

Splunk HEC エクスポータには、Splunk HEC トークンとエンドポイントが必要です。HEC トークンの取得と HEC エンドポイントの選択は、ターゲットによって異なります。次の表に、各バックエンドのエンドポイントと手順を示します。Splunk Cloud Platform または Splunk Enterprise にログを送信する場合は、sourcesourcetype フィールドのオプションを使用します。

バックエンド

エンドポイント

トークン

Splunk Cloud Platform

Send data to HTTP Event Collector on Splunk Cloud Platform」を参照してください。

Manage HTTP Event Collector (HEC) tokens in Splunk Cloud Platform」を参照してください。

Splunk Enterprise

Send data to HTTP Event Collector on Splunk Enterprise」を参照してください。

Create an Event Collector token on Splunk Enterprise」を参照してください。

Splunk Observability Cloud

https://ingest.<realm>.signalfx.com/v1/log <realm> は Splunk Observability Cloud レルムで、例えば us0 です。

Splunk Observability Cloud を使用した組織のアクセストークンの作成および管理」を参照してください。

Splunk レルムを検出するには「View your realm, API endpoints, and organization」を参照してください。

注: Splunk HEC データをプロキシ経由で送信するには、プロキシ設定を環境変数として構成します。詳しくは「Configure proxy settings for the Collector」を参照してください。

ユースケース

ログを Splunk Cloud Platform または Splunk Enterprise に送信する

ログ収集に Collector を使用していて、Splunk Cloud Platform または Splunk Enterprise にデータを送信する必要がある場合は、splunk_hec エクスポータを設定して、Splunk endpointtoken を使用します。例:

exporters:
   splunk_hec:
      # Splunk HTTP Event Collector token.
      token: "00000000-0000-0000-0000-0000000000000"
      # URL to a Splunk instance to send data to.
      endpoint: "https://splunk:8088/services/collector"
      # Optional Splunk source: https://docs.splunk.com/Splexicon:Source
      source: "otel"
      # Optional Splunk source type: https://docs.splunk.com/Splexicon:Sourcetype
      sourcetype: "otel"
      # Splunk index, optional name of the Splunk index targeted.
      index: "metrics"
      # Whether to deactivate gzip compression over HTTP. Defaults to false.
      disable_compression: false
      # HTTP timeout when sending data. Defaults to 10s.
      timeout: 10s
      # Whether to skip checking the certificate of the HEC endpoint when sending data over HTTPS. Defaults to false.
      tls:
        insecure_skip_verify: true

Splunk Platform と Splunk Observability Cloud の間でログデータを分割して、ログを Splunk プラットフォームに送信しながら AlwaysOn Profiling データを保持することができます。詳しくは「Check the OpenTelemetry Collector configuration」を参照してください。

ログパイプラインを分割するには、Collector 構成ファイルの receiver および exporters セクションに 2 つの別々の splunk_hec エントリを設定します。次に、両方を logs パイプラインに追加します。例:

receivers:
  # Default OTLP receiver--used by Splunk platform logs
  otlp:
    protocols:
      grpc:
        endpoint: 0.0.0.0:4317
      http:
        endpoint: 0.0.0.0:4318
   # OTLP receiver for AlwaysOn Profiling data
  otlp/profiling:
    protocols:
      grpc:
      # Make sure to configure your agents
      # to use the custom port for logs when
      # setting SPLUNK_PROFILER_LOGS_ENDPOINT
        endpoint: 0.0.0.0:4319

exporters:
  # Export logs to Splunk platform
  splunk_hec/platform:
    token: "<splunk_token>"
    endpoint: "https://splunk:8088/services/collector"
    source: "otel"
    sourcetype: "otel"
    index: "main"
    disable_compression: false
    timeout: 10s
    tls:
      insecure_skip_verify: true
   # Export profiling data to Splunk Observability Cloud
  splunk_hec/profiling:
    token: "<splunk_o11y_token>"
    endpoint: "https://ingest.<realm>.signalfx.com/v1/log"
    source: "otel"
    sourcetype: "otel"
    log_data_enabled: false

processors:
  batch:
  memory_limiter:
    check_interval: 2s
    limit_mib: ${SPLUNK_MEMORY_LIMIT_MIB}

# Other settings

service:
  pipelines:
    # Traces and metrics pipelines
    # Logs pipeline for Splunk platform
    logs/platform:
      receivers: [fluentforward, otlp]
      processors:
      - memory_limiter
      - batch
      exporters: [splunk_hec/platform]
     # Logs pipeline for AlwaysOn Profiling
    logs/profiling:
      receivers: [otlp/profiling]
      processors:
      - memory_limiter
      - batch
      exporters: [splunk_hec/profiling]

ログまたはプロファイリングデータをオフにする

注: Splunk Distribution of OpenTelemetry Collector のバージョン 0.81 から、ログとプロファイリング パイプラインが分割されるようになりました。その場合、必要に応じてログとプロファイリングを削除したり、コメントアウトしたりすることができます。

特定のホストまたはコンテナの AlwaysOn Profiling データが不要な場合は、Collector 構成ファイルの splunk_hec エクスポータ設定で profiling_data_enabled オプションを false に設定します。例:

splunk_hec:
  token: "${SPLUNK_HEC_TOKEN}"
  endpoint: "${SPLUNK_HEC_URL}"
  source: "otel"
  sourcetype: "otel"
  profiling_data_enabled: false

APM 用の AlwaysOn Profiling データを保持しながら Splunk Observability Cloud 用のログ収集をオフにするには、log_data_enabled オプションを false に設定します。詳しくは「Exclude log data in the Collector」を参照してください。

splunk_hec/profiling:
  token: "${SPLUNK_HEC_TOKEN}"
  endpoint: "${SPLUNK_HEC_URL}"
  source: "otel"
  sourcetype: "otel"
  log_data_enabled: false

Log Observer Connect を使用しているなどの理由で Splunk Observability Cloud へのログデータエクスポートをオフにする必要がある場合は、Collector 構成ファイルの splunk_hec エクスポータで log_data_enabledfalse に設定します。

splunk_hec:
  token: "${SPLUNK_HEC_TOKEN}"
  endpoint: "${SPLUNK_HEC_URL}"
  source: "otel"
  sourcetype: "otel"
  log_data_enabled: false
注: log_data_enabled の設定は、OpenTelemetry Collector バージョン 0.49.0 以降の Splunk ディストリビューションで利用可能です。

EC2 のカスタム設定を使用するには「Deploy the Collector using a custom configuration」を参照してください。Fargate のカスタム設定を使用するには「Use a custom configuration」を参照してください。

Helm チャートを使用して Kubernetes に Collector をデプロイしている場合は、カスタムチャートまたは values.yaml ファイルの splunkObservability セクションで以下の設定を変更してください。

splunkObservability:
  # Other settings
  logsEnabled: false

メトリクスを Splunk Cloud Platform または Splunk Enterprise に送信する

Collector を使用して、Splunk Cloud Platform または Splunk Enterprise にメトリクスを送信できます。

たとえば、以下のような設定で Prometheus のメトリクスをスクレイピングしている場合。

pipelines:
  metrics:
      receivers: [prometheus]
      processors: [batch]
      exporters: [splunk_hec/metrics]

receivers:
  prometheus:
    config:
      scrape_configs:
        - job_name: 'otel-collector'
          scrape_interval: 5s
          static_configs:
            - targets: ['<container_name>:<container_port>']

次の例に示すように、splunk_hec エクスポーターを設定する必要があります:

exporters:
    splunk_hec/metrics:
        # Splunk HTTP Event Collector token.
        token: "00000000-0000-0000-0000-0000000000000"
        # URL to a Splunk instance to send data to.
        endpoint: "https://splunk:8088/services/collector"
        # Optional Splunk source: https://docs.splunk.com/Splexicon:Source
        source: "app"
        # Optional Splunk source type: https://docs.splunk.com/Splexicon:Sourcetype
        sourcetype: "jvm_metrics"
        # Splunk index, optional name of the Splunk index targeted.
        index: "metrics"

Splunk HEC を介してメトリクスを取り込めるようにするには、インデックスをメトリクスインデックスとして宣言する必要があることに注意してください。メトリクスインデックスについて詳しくは「Get started with metrics」を参照してください。

設定

次の表は、Splunk HEC エクスポータの設定オプションを示しています。max_idle_connsmax_idle_conns_per_host などの HTTP 設定については、GitHub の「HTTP config options for the Collector」を参照してください。

同梱

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

トラブルシューティング

__ ___ ___ _ ______ _____________ _____ ________ ___ ___ ___ ____ __ ___ ____ ____ __ ______ _____________ ______ ___ ___ ___ ____ __ ___ _________ _____

_________ __ ______ _____________ _____ _________

_________ __ ___________ _________ ___ ____ _____ _____

  • ___ _ ________ ___ ___ _______ _______ _________ _______ __ ______ ________

  • ____ ___ ______ ______________ ____ _____ _____ _______ __ ___________ ____ __________ _________ ___ ______ _________ __________ __ _____ ___ ____ _______