次の方法で共有


OEPDataplaneLogs テーブルのクエリ

これらのクエリを Azure ポータルで使用する方法については、Log Analytics チュートリアルをご参照ください。 REST API については、「 Query」を参照してください。

エラー応答コードの視覚化

HTTP 応答コードでログ メッセージを分類し、応答コードなしでログを除外し、指定された時間の細分性で各応答コードの数を集計します。 次に、視覚化用の縦棒グラフをレンダリングします。

OEPDataplaneLogs
// Categorize messages based on HTTP response codes
| extend ResponseCode = case(
    Message has_any ("Status=500", "Internal Server Error"), "500",
    Message has_any ("Status=401", "Unauthorized"), "401",
    Message has_any ("Status=403", "Forbidden"), "403",
    Message has_any ("Status=429", "RequestBodyTooLarge"), "429",
    ""
)
// Filter out logs without a response code
| where ResponseCode != ""
// Summarize the count of each response code over a specified time range
| summarize Count = count() by bin(TimeGenerated, 5m), ResponseCode
// Render a column chart for visualization
| render columnchart

ストレージ ログでのユーザー アクティビティの分析

UserId 値を抽出し、UserId を持ち StorageLogs カテゴリに属するもののみを含むようにログをフィルター処理し、特定の HTTP メソッドをチェックします。 次に、1 日の間隔でユーザーごとのログの数を集計し、視覚化用の円グラフをレンダリングします。

OEPDataplaneLogs
// Extract UserId from the Message field using a regular expression
| extend UserId = extract(@"user-id=([a-zA-Z0-9_-@.]+)", 1, Message)
// Filter out logs without a UserId
| where UserId != ""
// Filter logs to include only those in the "StorageLogs" category
| where Category == "StorageLogs"
// Filter logs to include only those with specific HTTP methods
| where Message has_any (  
  "GET",
  "POST",
  "PUT",
  "DELETE",
  "PATCH",
  "HEAD",
  "OPTIONS" 
)
// Summarize the count of logs per user over daily intervals
| summarize Count = count() by bin(TimeGenerated, 1d), UserId
// Render a pie chart for visualization
| render piechart

OSDU サービスによるログの分類

この KQL クエリは、過去 24 時間のカテゴリ別のログの数を集計し、視覚化用の円グラフを表示します。

OEPDataplaneLogs
// Summarize the count of logs by category over the last day
| summarize Count = count() by bin(TimeGenerated, 1d), Category
// Render a pie chart for visualization
| render piechart

ユーザー アクティビティの視覚化

UserId 値を抽出し、UserId を使用せずにログを除外し、過去 24 時間のユーザーあたりのログ数を集計します。 ユーザー アクティビティを視覚化する円グラフをレンダリングします。

OEPDataplaneLogs
// Extract UserId from the Message field using a regular expression
| extend UserId = extract(@"user-id=([a-zA-Z0-9_-@.]+)", 1, Message)
// Filter out logs without a UserId
| where UserId != ""
// Summarize the count of logs per user over the last day
| summarize Count = count() by bin(TimeGenerated, 1d), UserId
// Render a pie chart to visualize user activity
| render piechart

最近のアクティビティの視覚化

過去 30 分間のログをフィルター処理し、HTTP 応答コードで分類し、ログとエラーの合計数をカウントします。 次に、これらのカウントを 15 秒間隔で集計し、ビジュアル分析用のタイムチャートをレンダリングします。

OEPDataplaneLogs
// Filter logs to the last 30 minutes
| where TimeGenerated >= ago(30m)
// | extend UserId = extract(@"user-id=([a-zA-Z0-9_-@.]+)", 1, Message) // Uncomment if you want to only display user actions
// | where notempty(UserId) //// Uncomment if you want to only display user actions
// Categorize messages based on HTTP response codes
| extend ResponseCode = case(
    Message has_any ("Status=500", "Internal Server Error"), "500",
    Message has_any ("Status=401", "Unauthorized"), "401",
    Message has_any ("Status=403", "Forbidden"), "403",
    Message has_any ("Status=429", "RequestBodyTooLarge"), "429",
    ""
)
// Mark entries as errors if they match specific response codes
| extend ErrorCount = ResponseCode has_any ("500", "401", "403", "429")
// Summarize total logs and errors in 15-second intervals
| summarize Total = count(), Errors = count(ErrorCount) by bin(TimeGenerated, 15s)
// Render a timechart for visual analysis
| render timechart with (ysplit=axes)

関連付け ID の存在の確認

各ログ エントリに CorrelationId があることを確認します。 CorrelationId がない場合は、正規表現を使用してメッセージ フィールドから値を抽出します。

OEPDataplaneLogs
// Ensure each log entry has a CorrelationId by using the existing one or extracting it from the Message field
| extend CorrelationId = iff(notempty(CorrelationId), CorrelationId, extract(@"correlation-id=([a-zA-Z0-9_-]+)", 1, Message))

HTTP 応答コードの抽出と分類

HTTP 応答コードに基づいてログ メッセージを分類します。 これにより、ResponseCode という新しい列でログ データが拡張され、関連するフィールドのみが表示されます。

OEPDataplaneLogs
// Define ResponseCodes based on Message content and extends into a separate column.
| extend ResponseCode = case(
    Message has_any ("Status=500", "Internal Server Error"), "500",  // Internal Server Error
    Message has_any ("Status=401", "Unauthorized"), "401",           // Unauthorized Access
    Message has_any ("Status=403", "Forbidden"), "403",              // Forbidden Access
    Message has_any ("Status=429", "RequestBodyTooLarge"), "429",    // Request Body Too Large
    Message has_any ("Status=200", "200 OK"), "200",                 // Successful Request
    Message has "Status=201", "201",                                 // Resource Created
    ""                                                               // Default case if no match
)
//
// Displays only relevant columns
//
| project TimeGenerated, Category, Message, LogLevel, CorrelationId, ResponseCode