Query - Get

Elemzési lekérdezés végrehajtása
Adatelemzési lekérdezés végrehajtása

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-paraméterek

Name In Kötelező Típus Description
workspaceId
path True

string

A munkaterület azonosítója. Ez a munkaterület azonosítója a Azure Portal Tulajdonságok paneljén.

query
query True

string

Az Analytics-lekérdezés. További információ az Analytics lekérdezési szintaxisáról

timespan
query

string

duration

Választható. Az adatok lekérdezésének időtartománya. Ez egy ISO8601 időszak értéke. Ez az időtartomány a lekérdezési kifejezésben megadottakon felül lesz alkalmazva.

Válaszok

Name Típus Description
200 OK

queryResults

OK gombra. Az API-hívás sikeres volt, és az Analytics-lekérdezés eredménye a válasz hasznos adata

Other Status Codes

errorResponse

Hibaválasz-objektum.

Biztonság

oauth2

Azure Active Directory OAuth2 Flow

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

Scopes

Name Description
user_impersonation felhasználói fiók megszemélyesítése

Példák

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"
        ]
      ]
    }
  ]
}

Definíciók

Name Description
column

Egy táblaoszlop.

errorDetail

Hiba részletei.

errorInfo

A hiba kódja és üzenete.

errorResponse

Hiba részletei.

logsColumnType

Az oszlop adattípusa.

queryResults

Lekérdezési válasz.

Render

Vizualizációs adatok JSON formátumban.

Statistics

JSON formátumban ábrázolt statisztikák.

table

Lekérdezési választábla.

column

Egy táblaoszlop.

Name Típus Description
name

string

Az oszlop neve.

type

logsColumnType

Az oszlop adattípusa.

errorDetail

Hiba részletei.

Name Típus Description
additionalProperties

object

A hiba részletei objektumon megadható további tulajdonságok

code

string

A hiba kódja.

message

string

Emberi olvasásra alkalmas hibaüzenet.

resources

string[]

A hibáért felelős erőforrásokat jelzi.

target

string

Azt jelzi, hogy a kérelem melyik tulajdonsága felelős a hibáért.

value

string

Azt jelzi, hogy a "cél" melyik értéke felelős a hibáért.

errorInfo

A hiba kódja és üzenete.

Name Típus Description
additionalProperties

object

A hibainformációs objektumon megadható további tulajdonságok

code

string

Géppel olvasható hibakód.

details

errorDetail[]

hiba részletei.

innererror

errorInfo

A hiba kódja és üzenete.
Belső hiba részletei, ha léteznek.

message

string

Emberi olvasásra alkalmas hibaüzenet.

errorResponse

Hiba részletei.

Name Típus Description
error

errorInfo

A hiba kódja és üzenete.
A hiba részletei.

logsColumnType

Az oszlop adattípusa.

Name Típus Description
bool

string

datetime

string

decimal

string

dynamic

string

guid

string

int

string

long

string

real

string

string

string

timespan

string

queryResults

Lekérdezési válasz.

Name Típus Description
error

errorInfo

A hiba kódja és üzenete.

render

Render

Vizualizációs adatok JSON formátumban.

statistics

Statistics

JSON formátumban ábrázolt statisztikák.

tables

table[]

A táblák, oszlopok és sorok listája.

Render

Vizualizációs adatok JSON formátumban.

Statistics

JSON formátumban ábrázolt statisztikák.

table

Lekérdezési választábla.

Name Típus Description
columns

column[]

A táblázat oszlopainak listája.

name

string

A tábla neve.

rows

object[]

A lekérdezés eredményként kapott sorai.