Azure Monitorで使用されているKQLの書き方をちょっとだけ調べた
業務でAzure Database for PostgreSQLのログを調査する機会が時々発生していたのですが、その際普通のSQLのようにあクエリを書こうと思ったものの、うまく動作せず、毎回Limitをかけたほぼ全文検索のような形で対応していて、「スマートじゃないなぁ....」っと思っていたので、脱出するべく調べたことを書き記したいと思います。
Azure Monitor使用されているクエリはKQL
Azure Database for PostgreSQLのAzure Monitor使用されているクエリはKQL(Kustoクエリ言語)というものが使われているようです
以下はサンプルクエリになります。
以下のコードを説明すると、AzureActivityテーブルのTimeGeneratedの日付が2020年10月01日以降かつ、TimeGeneratedが2020年10月07日以前のもかつ、LevelがCriticalに一致するレコードのみを表示するという文になります。
AzureActivity
| where TimeGenerated > datetime(10-01-2020) and TimeGenerated < datetime(10-07-2020)
| where Level == 'Critical'
参考資料
https://docs.microsoft.com/ja-jp/azure/azure-monitor/logs/log-query-overview
https://docs.microsoft.com/ja-jp/azure/data-explorer/kusto/query/samples?pivots=azuremonitor
https://docs.microsoft.com/ja-jp/azure/data-explorer/kusto/query/tutorial?pivots=azuremonitor
Author And Source
この問題について(Azure Monitorで使用されているKQLの書き方をちょっとだけ調べた), 我々は、より多くの情報をここで見つけました https://qiita.com/nnnobuo/items/4779e5e428cbc93ac7a1著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .