Docs » Splunk Distribution of the OpenTelemetry Collector の利用開始 » Collector コンポーネント » Collectorコンポーネント: プロセッサー » 属性プロセッサー

属性プロセッサー 🔗

属性プロセッサーは、アクションによってスパン、メトリクス、またはログの属性を変更する OpenTelemetry Collector のコンポーネントです。1つのプロセッサー・インスタンスでアクションを組み合わせて、複雑な処理を実行できます。使用例としては、機密情報の難読化、新しいキーへの値のコピー、属性の埋め戻しなどがあります。

スパン、メトリクス、またはログの収集された属性に対して、次のいずれかのアクションを適用できます:

アクション

説明

insert

特定の key を欠くデータに新しい属性を挿入します。このデータには valuefrom_attributefrom_context のいずれかが定義されていなければなりません。

update

valuefrom_attributefrom_context のいずれかが定義されていなければならない、特定の key を持つデータの属性を更新します。

upsert

key が存在するかどうかに応じて、データ内の属性を更新または挿入します。 key には valuefrom_attributefrom_context のいずれかが定義されていなければなりません。

delete

特定の key または pattern を持つ属性をデータから削除します。

hash

特定の key または pattern を持つ既存の属性の値を、SHA1 アルゴリズムを使ってハッシュします。

extract

正規表現ルールを使用して値を抽出します。pattern が必要です。

convert

intdoublestring のいずれかである converted_type パラメータで指定されるように、属性を別のタイプに変換します。

注釈

メトリクス変換プロセッサを使用して、メトリクスの名前を変更したり、ラベル・キーや値を追加、名前変更、削除し たりできます。また、このプロセッサーを使用して、ラベルまたはラベル値にまたがるメトリクスのスケーリングや集約を実行することもできます。メトリクストランスフォームプロセッサー を参照してください。

スパン全体、ログ、またはメトリクスを含めたり除外したりするには、フィルターープロセッサーを使用します。フィルターープロセッサー を参照してください。

はじめに 🔗

デフォルトでは、OpenTelemetry Collector の Splunk ディストリビューションには属性プロセッサーが含まれています。パイプラインの属性プロセッサーを有効にするには、設定の processors セクションに attributes を追加します。例:

processors:
  attributes/example:
    actions:
      - key: db.table
        action: delete
      - key: redacted_span
        value: "new_value"
        action: upsert
      - key: copy_key
        from_attribute: key_original
        action: update
      - key: account_id
        value: 33445
        action: insert
      - key: account_password
        action: delete
      - key: account_email
        action: hash
      - key: http.status_code
        action: convert
        converted_type: int

その後、互換性のあるパイプラインに属性プロセッサーを追加することができます。例:

service:
  pipelines:
    traces:
      receivers: [jaeger, otlp, zipkin]
      processors:
      - attributes/traces
      - memory_limiter
      - batch
      - resourcedetection
      exporters: [sapm, signalfx]
    metrics:
      receivers: [hostmetrics, otlp, signalfx]
      processors:
      - attributes/metrics
      - memory_limiter
      - batch
      - resourcedetection
      exporters: [signalfx]
    logs:
      receivers: [fluentforward, otlp]
      processors:
      - attributes/logs
      - memory_limiter
      - batch
      - resourcedetection
      exporters: [splunk_hec]

属性を包含または除外するには、以下のプロパティのいずれかを使用します:

  • services

  • resources

  • libraries

  • span_names

  • log_bodies

  • log_severity_texts

  • metric_names

  • attributes

次の例は、特定のサービスに delete アクションを適用する方法を示します:

attributes/selectiveprocessing:
  include:
    match_type: strict
    services: ["service1", "service2"]
  actions:
    - key: sensitive_field
      action: delete

パラメータの完全なリストについては、設定 を参照してください。

サンプル構成 🔗

以下のサンプル設定は、属性に対して異なるアクションを実行する方法を示しています。

注釈

例の完全なリストは、https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/processor/attributesprocessor/testdata/config.yaml のコンフィギュレーション・スニペットを参照してください。

ログから機密情報を削除または難読化する 🔗

次の例は、トークン属性を削除し、電子メールをハッシュ化し、ログ中のパスワードを再編集する方法を示しています:

attributes/log_body_regexp:
  include:
    match_type: regexp
      log_bodies: ["AUTH.*"]
    actions:
      - key: password
        action: update
        value: "Redacted"
      - key: apitoken
        action: delete
      - key: email
        action: hash

別の属性の値に基づいて新しい属性を作成する 🔗

次の例は、スパン内の別の属性の値に基づいて新しい属性を作成する方法を示しています:

attributes/createattributes:
  actions:
      # Creates four new attributes (defined in pattern) from the
      # value of the http.url attribute
    - key: "http.url"
        pattern: ^(?P<http_protocol>.*):\\/\\/(?P<http_domain>.*)\\/(?P<http_path>.*)(\\?|\\&)(?P<http_query_params>.*)
        action: extract

属性が欠けているスパンを埋め戻す 🔗

次の例は、属性が欠けているスパンを埋め戻す方法を示しています:

attributes/complex:
  actions:
    - key: operation
      value: default
      action: insert
    - key: svc.operation
      from_attribute: operation
      action: upsert
    - key: operation
      action: delete

その他の例とシナリオ 🔗

以下のシナリオも参照してください:

設定 🔗

次の表は、属性プロセッサーの設定オプションを示します:

トラブルシューティング 🔗

Splunk Observability Cloudをご利用のお客様で、Splunk Observability Cloudでデータを確認できない場合は、以下の方法でサポートを受けることができます。

Splunk Observability Cloudをご利用のお客様

見込み客および無料トライアルユーザー様

  • Splunk Answers のコミュニティサポートで質問し、回答を得る

  • Splunk #observability ユーザーグループの Slack チャンネルに参加して、世界中の顧客、パートナー、Splunk 社員とのコミュニケーションを図る。参加するには、Get Started with Splunk Community マニュアルの チャットグループ を参照してください。

This page was last updated on 2024年05月29日.