Query - Get

Analiz sorgusu yürütme
Veriler için analiz sorgusu yürütür

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 Parametreleri

Name İçinde Gerekli Tür Description
workspaceId
path True

string

Çalışma alanının kimliği. Bu, Azure portal Özellikler dikey penceresindeki Çalışma Alanı Kimliği'dir.

query
query True

string

Analiz sorgusu. Analiz sorgusu söz dizimi hakkında daha fazla bilgi edinin

timespan
query

string

duration

İsteğe bağlı. Verilerin sorgulandığı zaman aralığı. Bu ISO8601 zaman aralığı değeridir. Bu zaman aralığı, sorgu ifadesinde belirtilenlere ek olarak uygulanır.

Yanıtlar

Name Tür Description
200 OK

queryResults

Tamam ögesini seçin. API çağrısı başarılı oldu ve Analytics sorgu sonucu yanıt yükünde

Other Status Codes

errorResponse

Hata yanıtı nesnesi.

Güvenlik

oauth2

Azure Active Directory OAuth2 Flow

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

Scopes

Name Description
user_impersonation kullanıcı hesabınızın kimliğine bürünme

Örnekler

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

Tanımlar

Name Description
column

Tablo sütunu.

errorDetail

Hata ayrıntıları.

errorInfo

Hatanın kodu ve iletisi.

errorResponse

Hata ayrıntıları.

logsColumnType

Bu sütunun veri türü.

queryResults

Sorgu yanıtı.

Render

JSON biçiminde görselleştirme verileri.

Statistics

JSON biçiminde temsil edilen istatistikler.

table

Sorgu yanıt tablosu.

column

Tablo sütunu.

Name Tür Description
name

string

Bu sütunun adı.

type

logsColumnType

Bu sütunun veri türü.

errorDetail

Hata ayrıntıları.

Name Tür Description
additionalProperties

object

Hata ayrıntıları nesnesinde sağlanabilir ek özellikler

code

string

Hatanın kodu.

message

string

okunabilir bir hata iletisi.

resources

string[]

Hatadan sorumlu kaynakları gösterir.

target

string

İstekteki hangi özelliğin hatadan sorumlu olduğunu gösterir.

value

string

Hatadan 'target' içindeki hangi değerin sorumlu olduğunu gösterir.

errorInfo

Hatanın kodu ve iletisi.

Name Tür Description
additionalProperties

object

Hata bilgisi nesnesinde sağlanabilir ek özellikler

code

string

Makine tarafından okunabilir bir hata kodu.

details

errorDetail[]

hata ayrıntıları.

innererror

errorInfo

Hatanın kodu ve iletisi.
İç hata ayrıntıları varsa.

message

string

okunabilir bir hata iletisi.

errorResponse

Hata ayrıntıları.

Name Tür Description
error

errorInfo

Hatanın kodu ve iletisi.
Hata ayrıntıları.

logsColumnType

Bu sütunun veri türü.

Name Tür Description
bool

string

datetime

string

decimal

string

dynamic

string

guid

string

int

string

long

string

real

string

string

string

timespan

string

queryResults

Sorgu yanıtı.

Name Tür Description
error

errorInfo

Hatanın kodu ve iletisi.

render

Render

JSON biçiminde görselleştirme verileri.

statistics

Statistics

JSON biçiminde temsil edilen istatistikler.

tables

table[]

Tablo, sütun ve satır listesi.

Render

JSON biçiminde görselleştirme verileri.

Statistics

JSON biçiminde temsil edilen istatistikler.

table

Sorgu yanıt tablosu.

Name Tür Description
columns

column[]

Bu tablodaki sütunların listesi.

name

string

Tablonun adı.

rows

object[]

Bu sorgudan elde edilen satırlar.