属性プロセッサー
属性プロセッサを使用すると、スパン、メトリクス、またはログの属性を変換、編集(マスク)、更新、ハッシュ化、または削除することができます。コンポーネントの設定方法については、続きをお読みください。
属性プロセッサは、アクションを通じてスパン、メトリック、またはログの属性を変更する OpenTelemetry Collector コンポーネントです。単一のプロセッサインスタンスでアクションを組み合わせて、複雑な操作を実行できます。ユースケースには、機密情報の難読化、新しいキーへの値のコピー、属性のバックフィルなどがあります。
スパン、メトリクス、またはログの収集された属性に対して、次のいずれかのアクションを適用できます:
|
アクション |
説明 |
|---|---|
|
|
特定の |
|
|
|
|
|
|
|
|
特定の |
|
|
特定の |
|
|
正規表現ルールを使用して値を抽出します。 |
|
|
|
はじめに
Splunk Distribution of OpenTelemetry Collector には、パイプラインにデフォルトで属性プロセッサが含まれています。パイプラインの属性プロセッサを有効にするには、設定の 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: [otlphttp, 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
パラメータの完全なリストについては、「Settings」をご確認ください。
サンプル構成
以下のサンプル設定は、属性に対して異なるアクションを実行する方法を示しています。
ログから機密情報を削除または難読化する
次の例は、トークン属性を削除し、電子メールをハッシュ化し、ログ中のパスワードを再編集する方法を示しています:
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
その他の例とシナリオ
以下のシナリオも参照してください:
設定
次の表は、属性プロセッサーの設定オプションを示します:
https://raw.githubusercontent.com/splunk/collector-config-tools/main/cfg-metadata/processor/attributes.yaml
トラブルシューティング
__ ___ ___ _ ______ _____________ _____ ________ ___ ___ ___ ____ __ ___ ____ ____ __ ______ _____________ ______ ___ ___ ___ ____ __ ___ _________ _____
_________ __ ______ _____________ _____ _________
-
______ _ ____ __ ___ ______ _______ _______
-
_______ ______ ________
_________ __ ___________ _________ ___ ____ _____ _____
-
___ _ ________ ___ ___ _______ _______ _________ _______ __ ______ ________
-
____ ___ ______ ______________ ____ _____ _____ _______ __ ___________ ____ __________ _________ ___ ______ _________ __________ __ _____ ___ ____ _______