◾️はじめに
datadog の Array processor を使ったので、メモ。
目次
【0】Array processor / 配列プロセッサー 【1】Select value from a matching element (一致する要素から値を選択) 【2】Compute the length of an array (配列の長さ) 【3】Append a value to an array (配列への追加)
【0】Array processor / 配列プロセッサー
* 配列要素に対して、「Select the array processor」で 以下の3つの操作を行うことができるプロセッサー [1] Select value from a matching element [2] Compute the length of an array [3] Append a value to an array
https://docs.datadoghq.com/logs/log_configuration/processors/?tab=ui#array-processor
【1】Select value from a matching element (一致する要素から値を選択)
* 条件に一致するオブジェクトが配列内にある場合、 そのオブジェクトから特定の値を抽出
【2】Compute the length of an array (配列の長さ)
* 配列の要素数を計算
1)使用例
* 以下の入力データの配列の長さを出力することを考える => 以下の表のように設定すると「今回の出力結果例」のような結果が得られる
例: 入力データ
{ "demo_tags": ["prod", "internal", "critical"] }
# | 設定項目 | 説明 | 設定値の例 |
---|---|---|---|
[1] | Select the processor type | プロセッサーの種類の選択 | Array Processor |
[2] | Name the processor | プロセッサー名 | Demo Array Processor |
[3] | Select the array processor | 配列プロセッサーの機能の選択 | Array length |
[4] | Array attribuite to extract the length of | 対象配列名 | demo_tags |
[5] | Set target attribute | 出力する属性名 | demo_result |
今回の出力結果例
demo_result: 3
【3】Append a value to an array (配列への追加)
* ログ内のターゲット配列属性の末尾に属性値を追加 * 注: ターゲット配列属性がログに存在しない場合は、自動的に作成
関連記事
datadog ~ 基礎知識編 ~
https://dk521123.hatenablog.com/entry/2024/03/30/004746
datadog ~ 属性/ファセット/属性検索@ ~
https://dk521123.hatenablog.com/entry/2025/02/26/150349
datadog ~ タグ ~
https://dk521123.hatenablog.com/entry/2025/02/27/002502
datadog pipeline ~ 基礎知識編 ~
https://dk521123.hatenablog.com/entry/2025/04/14/145556
datadog pipeline ~ 入門編 ~
https://dk521123.hatenablog.com/entry/2025/06/04/221715
datadog dashboard ~ 入門編 ~
https://dk521123.hatenablog.com/entry/2025/02/09/000106
datadog Logs ~ 入門編 ~
https://dk521123.hatenablog.com/entry/2025/02/14/200308
datadog Logs ~ 基本編 ~
https://dk521123.hatenablog.com/entry/2025/02/15/213417
datadog Alert ~ 入門編 ~
https://dk521123.hatenablog.com/entry/2025/02/16/232413