Query - Get

분석 쿼리 실행
데이터에 대한 분석 쿼리를 실행합니다.

GET https://api.loganalytics.io/v1/workspaces/{workspaceId}/query?query={query}
GET https://api.loganalytics.io/v1/workspaces/{workspaceId}/query?query={query}&timespan={timespan}

URI 매개 변수

Name In(다음 안에) 필수 형식 Description
workspaceId
path True

string

작업 영역의 ID입니다. Azure Portal 속성 블레이드의 작업 영역 ID입니다.

query
query True

string

분석 쿼리입니다. Analytics 쿼리 구문에 대해 자세히 알아보기

timespan
query

string

duration

선택 사항입니다. 데이터를 쿼리할 시간 범위입니다. 이는 ISO8601 기간 값입니다. 이 시간 범위는 쿼리 식에 지정된 시간 범위 외에 적용됩니다.

응답

Name 형식 Description
200 OK

queryResults

OK. API 호출이 성공하고 분석 쿼리 결과가 응답 페이로드에 있습니다.

Other Status Codes

errorResponse

오류 응답 개체입니다.

보안

oauth2

Azure Active Directory OAuth2 Flow

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation 사용자 계정 가장

예제

cross-workspace
simple-query

cross-workspace

Sample Request

GET https://api.loganalytics.io/v1/workspaces/63613592-b6f7-4c3d-a390-22ba13102111/query?query=union * | where TimeGenerated > ago(1h) | summarize count() by Type, TenantId

Sample Response

{
  "tables": [
    {
      "name": "PrimaryResult",
      "columns": [
        {
          "name": "Type",
          "type": "string"
        },
        {
          "name": "TenantId",
          "type": "string"
        },
        {
          "name": "count_",
          "type": "long"
        }
      ],
      "rows": [
        [
          "Usage",
          "63613592-b6f7-4c3d-a390-22ba13102111",
          "1"
        ],
        [
          "Usage",
          "d436f322-a9f4-4aad-9a7d-271fbf66001c",
          "1"
        ],
        [
          "BillingFact",
          "63613592-b6f7-4c3d-a390-22ba13102111",
          "1"
        ],
        [
          "BillingFact",
          "d436f322-a9f4-4aad-9a7d-271fbf66001c",
          "1"
        ],
        [
          "Operation",
          "63613592-b6f7-4c3d-a390-22ba13102111",
          "7"
        ],
        [
          "Operation",
          "d436f322-a9f4-4aad-9a7d-271fbf66001c",
          "5"
        ]
      ]
    }
  ]
}

simple-query

Sample Request

GET https://api.loganalytics.io/v1/workspaces/63613592-b6f7-4c3d-a390-22ba13102111/query?query=Usage | take 10&timespan=PT12H

Sample Response

x-ms-request-id: 58a37988-2c05-427a-891f-5e0e1266fcc5
x-ms-correlation-request-id: 58a37988-2c05-427a-891f-5e0e1266fcc5
{
  "tables": [
    {
      "name": "PrimaryResult",
      "columns": [
        {
          "name": "TenantId",
          "type": "string"
        },
        {
          "name": "Computer",
          "type": "string"
        },
        {
          "name": "TimeGenerated",
          "type": "datetime"
        },
        {
          "name": "SourceSystem",
          "type": "string"
        },
        {
          "name": "StartTime",
          "type": "datetime"
        },
        {
          "name": "EndTime",
          "type": "datetime"
        },
        {
          "name": "ResourceUri",
          "type": "string"
        },
        {
          "name": "LinkedResourceUri",
          "type": "string"
        },
        {
          "name": "DataType",
          "type": "string"
        },
        {
          "name": "Solution",
          "type": "string"
        },
        {
          "name": "BatchesWithinSla",
          "type": "long"
        },
        {
          "name": "BatchesOutsideSla",
          "type": "long"
        },
        {
          "name": "BatchesCapped",
          "type": "long"
        },
        {
          "name": "TotalBatches",
          "type": "long"
        },
        {
          "name": "AvgLatencyInSeconds",
          "type": "real"
        },
        {
          "name": "Quantity",
          "type": "real"
        },
        {
          "name": "QuantityUnit",
          "type": "string"
        },
        {
          "name": "IsBillable",
          "type": "bool"
        },
        {
          "name": "MeterId",
          "type": "string"
        },
        {
          "name": "LinkedMeterId",
          "type": "string"
        },
        {
          "name": "Type",
          "type": "string"
        }
      ],
      "rows": [
        [
          "b438b4f6-912a-46d5-9cb1-b44069212abc",
          "ContosoSQLSrv1",
          "2017-08-24T06:59:59Z",
          "OMS",
          "2017-08-24T06:00:00Z",
          "2017-08-24T06:59:59Z",
          "/subscriptions/e4272367-5645-4c4e-9c67-3b74b59a6982/resourcegroups/contosoazurehq/providers/microsoft.operationalinsights/workspaces/contosoretail-it",
          null,
          "Perf",
          "LogManagement",
          "1",
          "0",
          "0",
          "1",
          "1.286",
          "0.076408",
          "MBytes",
          "true",
          "a4e29a95-5b4c-408b-80e3-113f9410566e",
          "00000000-0000-0000-0000-000000000000",
          "Usage"
        ],
        [
          "b438b4f6-912a-46d5-9cb1-b44069212abc",
          "Store010Web3",
          "2017-08-24T06:59:59Z",
          "OMS",
          "2017-08-24T06:00:00Z",
          "2017-08-24T06:59:59Z",
          "/subscriptions/e4272367-5645-4c4e-9c67-3b74b59a6982/resourcegroups/contosoazurehq/providers/microsoft.operationalinsights/workspaces/contosoretail-it",
          null,
          "Perf",
          "LogManagement",
          "1",
          "0",
          "0",
          "1",
          "1.7",
          "0.106767",
          "MBytes",
          "true",
          "a4e29a95-5b4c-408b-80e3-113f9410566e",
          "00000000-0000-0000-0000-000000000000",
          "Usage"
        ]
      ]
    }
  ]
}

정의

Name Description
column

테이블 열입니다.

errorDetail

오류 세부 정보입니다.

errorInfo

오류에 대한 코드 및 메시지입니다.

errorResponse

오류 세부 정보입니다.

logsColumnType

이 열의 데이터 형식입니다.

queryResults

쿼리 응답입니다.

Render

JSON 형식의 시각화 데이터입니다.

Statistics

JSON 형식으로 표시된 통계입니다.

table

쿼리 응답 테이블입니다.

column

테이블 열입니다.

Name 형식 Description
name

string

이 열의 이름입니다.

type

logsColumnType

이 열의 데이터 형식입니다.

errorDetail

오류 세부 정보입니다.

Name 형식 Description
additionalProperties

object

오류 세부 정보 개체에 제공할 수 있는 추가 속성

code

string

오류의 코드입니다.

message

string

사람이 읽을 수 있는 오류 메시지입니다.

resources

string[]

오류를 담당한 리소스를 나타냅니다.

target

string

요청에서 오류를 담당하는 속성을 나타냅니다.

value

string

오류를 담당하는 '대상'의 값을 나타냅니다.

errorInfo

오류에 대한 코드 및 메시지입니다.

Name 형식 Description
additionalProperties

object

오류 정보 개체에 제공할 수 있는 추가 속성

code

string

컴퓨터에서 읽을 수 있는 오류 코드입니다.

details

errorDetail[]

오류 세부 정보입니다.

innererror

errorInfo

오류에 대한 코드 및 메시지입니다.
내부 오류 세부 정보(있는 경우)

message

string

사람이 읽을 수 있는 오류 메시지입니다.

errorResponse

오류 세부 정보입니다.

Name 형식 Description
error

errorInfo

오류에 대한 코드 및 메시지입니다.
오류 세부 정보입니다.

logsColumnType

이 열의 데이터 형식입니다.

Name 형식 Description
bool

string

datetime

string

decimal

string

dynamic

string

guid

string

int

string

long

string

real

string

string

string

timespan

string

queryResults

쿼리 응답입니다.

Name 형식 Description
error

errorInfo

오류에 대한 코드 및 메시지입니다.

render

Render

JSON 형식의 시각화 데이터입니다.

statistics

Statistics

JSON 형식으로 표시된 통계입니다.

tables

table[]

테이블, 열 및 행 목록입니다.

Render

JSON 형식의 시각화 데이터입니다.

Statistics

JSON 형식으로 표시된 통계입니다.

table

쿼리 응답 테이블입니다.

Name 형식 Description
columns

column[]

이 테이블의 열 목록입니다.

name

string

테이블의 이름입니다.

rows

object[]

이 쿼리의 결과 행입니다.