コンテンツへスキップ
For the complete documentation index, see llms.txt. This page is also available as Markdown.

NQL計算

compute コマンドはイベントテーブルからメトリクスを集計および抽出し、結果テーブルにオブジェクトごとのメトリクスが含まれた新しい列として追加します。これは with または include 句の後にのみ使用できます。

構文

...
| include... 
| compute <new_metric> = <metric>.<aggregation function>
...
| with... 
| compute <new_metric> = <metric>.<aggregation function>

例

devices during past 7d
| include execution.crashes during past 7d
| compute nb_crashes = number_of_crashes.sum()

‘count()’ 関数を使用する

フィールドを指定せずに使用すると、count() 集計関数がイベントテーブルに適用されます。例えば、次のクエリでは、compute 句によってデバイスごとに起動数の新しい列が追加されます。

devices during past 7d
| include device_performance.boots during past 7d
| compute nb_boots = count()

一意のインベントリオブジェクトを新しい列として数えることも、<object>.count() 構文を使用して行えます。関連イベントがあるかどうかに基づいて、1 または 0 を値として新しい列を追加します。次の例では、コンピュート句は、過去 7 日間に起動されたデバイスには 1 を、起動記録がないデバイスには 0 を返します。最後の文では、summarize 句を使用して起動されたデバイスの比率を計算します。

最終更新

役に立ちましたか?