Query - Get

Een Analytics-query uitvoeren
Hiermee wordt een Analytics-query voor gegevens uitgevoerd

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-parameters

Name In Vereist Type Description
workspaceId
path True

string

Id van de werkruimte. Dit is de werkruimte-id op de blade Eigenschappen in de Azure Portal.

query
query True

string

De Analysequery. Meer informatie over de analysequerysyntaxis

timespan
query

string

duration

Optioneel. De periode waarin gegevens moeten worden opgevraagd. Dit is een ISO8601 tijdsperiodewaarde. Deze periode wordt toegepast naast alle die zijn opgegeven in de query-expressie.

Antwoorden

Name Type Description
200 OK

queryResults

OK. De API-aanroep is geslaagd en het resultaat van de analysequery bevindt zich in de nettolading van het antwoord

Other Status Codes

errorResponse

Een foutreactieobject.

Beveiliging

oauth2

Azure Active Directory OAuth2-stroom

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

Scopes

Name Description
user_impersonation uw gebruikersaccount imiteren

Voorbeelden

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

Definities

Name Description
column

Een tabelkolom.

errorDetail

Foutdetails.

errorInfo

De code en het bericht voor een fout.

errorResponse

Foutdetails.

logsColumnType

Het gegevenstype van deze kolom.

queryResults

Een queryantwoord.

Render

Visualisatiegegevens in JSON-indeling.

Statistics

Statistieken weergegeven in JSON-indeling.

table

Een queryantwoordtabel.

column

Een tabelkolom.

Name Type Description
name

string

De naam van deze kolom.

type

logsColumnType

Het gegevenstype van deze kolom.

errorDetail

Foutdetails.

Name Type Description
additionalProperties

object

Aanvullende eigenschappen die kunnen worden opgegeven voor het object foutdetails

code

string

De code van de fout.

message

string

Een door mensen leesbaar foutbericht.

resources

string[]

Geeft resources aan die verantwoordelijk waren voor de fout.

target

string

Geeft aan welke eigenschap in de aanvraag verantwoordelijk is voor de fout.

value

string

Geeft aan welke waarde in 'doel' verantwoordelijk is voor de fout.

errorInfo

De code en het bericht voor een fout.

Name Type Description
additionalProperties

object

Aanvullende eigenschappen die kunnen worden opgegeven voor het foutinformatieobject

code

string

Een door de machine leesbare foutcode.

details

errorDetail[]

details van de fout.

innererror

errorInfo

De code en het bericht voor een fout.
Details van interne fout, indien aanwezig.

message

string

Een door mensen leesbaar foutbericht.

errorResponse

Foutdetails.

Name Type Description
error

errorInfo

De code en het bericht voor een fout.
De foutdetails.

logsColumnType

Het gegevenstype van deze kolom.

Name Type Description
bool

string

datetime

string

decimal

string

dynamic

string

guid

string

int

string

long

string

real

string

string

string

timespan

string

queryResults

Een queryantwoord.

Name Type Description
error

errorInfo

De code en het bericht voor een fout.

render

Render

Visualisatiegegevens in JSON-indeling.

statistics

Statistics

Statistieken weergegeven in JSON-indeling.

tables

table[]

De lijst met tabellen, kolommen en rijen.

Render

Visualisatiegegevens in JSON-indeling.

Statistics

Statistieken weergegeven in JSON-indeling.

table

Een queryantwoordtabel.

Name Type Description
columns

column[]

De lijst met kolommen in deze tabel.

name

string

De naam van de tabel.

rows

object[]

De resulterende rijen van deze query.