Query - Batch
Spuštění dávky analytických dotazů
Spustí dávku analytických dotazů na data.
Tady je příklad použití příkazu POST s analytickým dotazem.
POST https://api.loganalytics.io/v1/$batch
Text požadavku
Name | Vyžadováno | Typ | Description |
---|---|---|---|
requests | True |
Jeden požadavek v dávce. |
Odpovědi
Name | Typ | Description |
---|---|---|
200 OK |
OK. Volání rozhraní API bylo úspěšné a výsledek analytického dotazu je v datové části odpovědi. |
|
Other Status Codes |
Objekt odpovědi na chybu. |
Zabezpečení
oauth2
Tok Azure Active Directory OAuth2
Typ:
oauth2
Tok:
implicit
URL autorizace:
https://login.microsoftonline.com/common/oauth2/authorize
Rozsahy
Name | Description |
---|---|
user_impersonation | zosobnění uživatelského účtu |
Příklady
metadataPost
Ukázkový požadavek
POST https://api.loganalytics.io/v1/$batch
{
"requests": [
{
"id": "1",
"body": {
"query": "AppRequests | take 2"
},
"path": "/query",
"method": "POST",
"workspace": "d2d0e126-fa1e-4b0a-b647-250cdd471e68"
},
{
"id": "2",
"body": {
"query": "AppRequests | take 3"
},
"path": "/query",
"method": "POST",
"workspace": "d2d0e126-fa1e-4b0a-b647-250cdd471e68"
}
]
}
Ukázková odpověď
{
"responses": [
{
"id": "1",
"status": 200,
"body": {
"tables": [
{
"name": "PrimaryResult",
"columns": [
{
"name": "TenantId",
"type": "string"
},
{
"name": "TimeGenerated",
"type": "datetime"
},
{
"name": "Id",
"type": "string"
},
{
"name": "Source",
"type": "string"
},
{
"name": "Name",
"type": "string"
},
{
"name": "Url",
"type": "string"
},
{
"name": "Success",
"type": "bool"
},
{
"name": "ResultCode",
"type": "string"
},
{
"name": "DurationMs",
"type": "real"
},
{
"name": "PerformanceBucket",
"type": "string"
},
{
"name": "Properties",
"type": "dynamic"
},
{
"name": "Measurements",
"type": "dynamic"
},
{
"name": "OperationName",
"type": "string"
},
{
"name": "OperationId",
"type": "string"
},
{
"name": "OperationLinks",
"type": "dynamic"
},
{
"name": "ParentId",
"type": "string"
},
{
"name": "SyntheticSource",
"type": "string"
},
{
"name": "SessionId",
"type": "string"
},
{
"name": "UserId",
"type": "string"
},
{
"name": "UserAuthenticatedId",
"type": "string"
},
{
"name": "UserAccountId",
"type": "string"
},
{
"name": "AppVersion",
"type": "string"
},
{
"name": "AppRoleName",
"type": "string"
},
{
"name": "AppRoleInstance",
"type": "string"
},
{
"name": "ClientType",
"type": "string"
},
{
"name": "ClientModel",
"type": "string"
},
{
"name": "ClientOS",
"type": "string"
},
{
"name": "ClientIP",
"type": "string"
},
{
"name": "ClientCity",
"type": "string"
},
{
"name": "ClientStateOrProvince",
"type": "string"
},
{
"name": "ClientCountryOrRegion",
"type": "string"
},
{
"name": "ClientBrowser",
"type": "string"
},
{
"name": "ResourceGUID",
"type": "string"
},
{
"name": "IKey",
"type": "string"
},
{
"name": "SDKVersion",
"type": "string"
},
{
"name": "ItemCount",
"type": "int"
},
{
"name": "ReferencedItemId",
"type": "string"
},
{
"name": "ReferencedType",
"type": "string"
},
{
"name": "SourceSystem",
"type": "string"
},
{
"name": "Type",
"type": "string"
},
{
"name": "_ResourceId",
"type": "string"
}
],
"rows": [
[
"d2d0e126-fa1e-4b0a-b647-250cdd471e68",
"2021-06-02T00:18:13.317Z",
"a3273b160f86b5c4",
"",
"ServiceBus.process",
"",
true,
"200",
0,
"<250ms",
"{\"x-opt-enqueued-time\":\"1622593091\"}",
null,
"ServiceBus.process",
"e5d21caf619d4ef564a4b5920cadce47",
null,
"c6864f9d3649f302",
"",
"",
"",
"",
"",
"",
"",
"srikanta",
"PC",
"",
"",
"0.0.0.0",
"Edmonds",
"Washington",
"United States",
"",
"fc5f5a5d-d6d1-47f9-be1b-aa57185ec6be",
"b4f83947-968d-4e2f-82ad-804be07697ae",
"java:3.1.1-BETA.2",
1,
"",
"",
"Azure",
"AppRequests",
"/subscriptions/faa080af-c1d8-40ad-9cce-e1a450ca5b57/resourcegroups/srnagar-azuresdkgroup/providers/microsoft.insights/components/srnagarappinsights"
],
[
"d2d0e126-fa1e-4b0a-b647-250cdd471e68",
"2021-06-02T00:19:13.44Z",
"bebb49e7a1344c07",
"",
"ServiceBus.process",
"",
true,
"200",
0,
"<250ms",
"{\"x-opt-enqueued-time\":\"1622593091\"}",
null,
"ServiceBus.process",
"d76c6dec50d2c12267d7d3a246a0c237",
null,
"b68fff4775c77214",
"",
"",
"",
"",
"",
"",
"",
"srikanta",
"PC",
"",
"",
"0.0.0.0",
"Edmonds",
"Washington",
"United States",
"",
"fc5f5a5d-d6d1-47f9-be1b-aa57185ec6be",
"b4f83947-968d-4e2f-82ad-804be07697ae",
"java:3.1.1-BETA.2",
1,
"",
"",
"Azure",
"AppRequests",
"/subscriptions/faa080af-c1d8-40ad-9cce-e1a450ca5b57/resourcegroups/srnagar-azuresdkgroup/providers/microsoft.insights/components/srnagarappinsights"
]
]
}
]
}
},
{
"id": "2",
"status": 200,
"body": {
"tables": [
{
"name": "PrimaryResult",
"columns": [
{
"name": "TenantId",
"type": "string"
},
{
"name": "TimeGenerated",
"type": "datetime"
},
{
"name": "Id",
"type": "string"
},
{
"name": "Source",
"type": "string"
},
{
"name": "Name",
"type": "string"
},
{
"name": "Url",
"type": "string"
},
{
"name": "Success",
"type": "bool"
},
{
"name": "ResultCode",
"type": "string"
},
{
"name": "DurationMs",
"type": "real"
},
{
"name": "PerformanceBucket",
"type": "string"
},
{
"name": "Properties",
"type": "dynamic"
},
{
"name": "Measurements",
"type": "dynamic"
},
{
"name": "OperationName",
"type": "string"
},
{
"name": "OperationId",
"type": "string"
},
{
"name": "OperationLinks",
"type": "dynamic"
},
{
"name": "ParentId",
"type": "string"
},
{
"name": "SyntheticSource",
"type": "string"
},
{
"name": "SessionId",
"type": "string"
},
{
"name": "UserId",
"type": "string"
},
{
"name": "UserAuthenticatedId",
"type": "string"
},
{
"name": "UserAccountId",
"type": "string"
},
{
"name": "AppVersion",
"type": "string"
},
{
"name": "AppRoleName",
"type": "string"
},
{
"name": "AppRoleInstance",
"type": "string"
},
{
"name": "ClientType",
"type": "string"
},
{
"name": "ClientModel",
"type": "string"
},
{
"name": "ClientOS",
"type": "string"
},
{
"name": "ClientIP",
"type": "string"
},
{
"name": "ClientCity",
"type": "string"
},
{
"name": "ClientStateOrProvince",
"type": "string"
},
{
"name": "ClientCountryOrRegion",
"type": "string"
},
{
"name": "ClientBrowser",
"type": "string"
},
{
"name": "ResourceGUID",
"type": "string"
},
{
"name": "IKey",
"type": "string"
},
{
"name": "SDKVersion",
"type": "string"
},
{
"name": "ItemCount",
"type": "int"
},
{
"name": "ReferencedItemId",
"type": "string"
},
{
"name": "ReferencedType",
"type": "string"
},
{
"name": "SourceSystem",
"type": "string"
},
{
"name": "Type",
"type": "string"
},
{
"name": "_ResourceId",
"type": "string"
}
],
"rows": [
[
"d2d0e126-fa1e-4b0a-b647-250cdd471e68",
"2021-06-02T16:31:25.383Z",
"08bf242cdc68504c",
"",
"ServiceBus.process",
"",
true,
"200",
0,
"<250ms",
"{\"x-opt-enqueued-time\":\"1622651483\"}",
null,
"ServiceBus.process",
"65d9eb1ccf85b1b7ed1e2ea6bb72f563",
null,
"146140ce8493a6ed",
"",
"",
"",
"",
"",
"",
"",
"srikanta",
"PC",
"",
"",
"0.0.0.0",
"Edmonds",
"Washington",
"United States",
"",
"fc5f5a5d-d6d1-47f9-be1b-aa57185ec6be",
"b4f83947-968d-4e2f-82ad-804be07697ae",
"java:3.1.1-BETA.2",
1,
"",
"",
"Azure",
"AppRequests",
"/subscriptions/faa080af-c1d8-40ad-9cce-e1a450ca5b57/resourcegroups/srnagar-azuresdkgroup/providers/microsoft.insights/components/srnagarappinsights"
],
[
"d2d0e126-fa1e-4b0a-b647-250cdd471e68",
"2021-06-02T16:32:25.492Z",
"9f4cd78c10d57b4f",
"",
"ServiceBus.process",
"",
true,
"200",
0,
"<250ms",
"{\"x-opt-enqueued-time\":\"1622651483\"}",
null,
"ServiceBus.process",
"ae054fe7b7ac3adf8b841ebbe1ecb912",
null,
"14eab103a1969665",
"",
"",
"",
"",
"",
"",
"",
"srikanta",
"PC",
"",
"",
"0.0.0.0",
"Edmonds",
"Washington",
"United States",
"",
"fc5f5a5d-d6d1-47f9-be1b-aa57185ec6be",
"b4f83947-968d-4e2f-82ad-804be07697ae",
"java:3.1.1-BETA.2",
1,
"",
"",
"Azure",
"AppRequests",
"/subscriptions/faa080af-c1d8-40ad-9cce-e1a450ca5b57/resourcegroups/srnagar-azuresdkgroup/providers/microsoft.insights/components/srnagarappinsights"
],
[
"d2d0e126-fa1e-4b0a-b647-250cdd471e68",
"2021-06-02T16:33:25.585Z",
"ea7e09d4baa4e4ce",
"",
"ServiceBus.process",
"",
true,
"200",
0,
"<250ms",
"{\"x-opt-enqueued-time\":\"1622651483\"}",
null,
"ServiceBus.process",
"ba6162e3ccd803086944750b82600a3a",
null,
"b60455183860caaf",
"",
"",
"",
"",
"",
"",
"",
"srikanta",
"PC",
"",
"",
"0.0.0.0",
"Edmonds",
"Washington",
"United States",
"",
"fc5f5a5d-d6d1-47f9-be1b-aa57185ec6be",
"b4f83947-968d-4e2f-82ad-804be07697ae",
"java:3.1.1-BETA.2",
1,
"",
"",
"Azure",
"AppRequests",
"/subscriptions/faa080af-c1d8-40ad-9cce-e1a450ca5b57/resourcegroups/srnagar-azuresdkgroup/providers/microsoft.insights/components/srnagarappinsights"
]
]
}
]
}
}
]
}
Definice
Name | Description |
---|---|
batch |
Jeden požadavek v dávce. |
batch |
|
batch |
Odpověď na dotaz pro jeden dotaz v dávce. |
batch |
Pole požadavků. |
batch |
Odpověď na dávkový dotaz. |
column |
Sloupec tabulky. |
error |
Podrobnosti o chybě. |
error |
Kód a zpráva o chybě. |
error |
Podrobnosti o chybě. |
logs |
Datový typ tohoto sloupce. |
method |
|
path | |
query |
Analytický dotaz. Další informace o syntaxi analytických dotazů |
Render |
Vizualizační data ve formátu JSON. |
Statistics |
Statistika reprezentovaná ve formátu JSON |
table |
Tabulka odpovědí na dotaz |
batchQueryRequest
Jeden požadavek v dávce.
Name | Typ | Description |
---|---|---|
body |
Analytický dotaz. Další informace o syntaxi analytických dotazů |
|
headers |
object |
|
id |
string |
Podrobnosti o chybě. |
method | ||
path | ||
workspace |
string |
ID pracovního prostoru, které se má zahrnout do dotazu |
batchQueryResponse
Name | Typ | Description |
---|---|---|
body |
Odpověď na dotaz pro jeden dotaz v dávce. |
|
headers |
object |
|
id |
string |
|
status |
integer |
batchQueryResults
Odpověď na dotaz pro jeden dotaz v dávce.
Name | Typ | Description |
---|---|---|
error |
Kód a zpráva o chybě. |
|
render |
Vizualizační data ve formátu JSON. |
|
statistics |
Statistika reprezentovaná ve formátu JSON |
|
tables |
table[] |
Seznam tabulek, sloupců a řádků. |
batchRequest
Pole požadavků.
Name | Typ | Description |
---|---|---|
requests |
Jeden požadavek v dávce. |
batchResponse
Odpověď na dávkový dotaz.
Name | Typ | Description |
---|---|---|
responses |
Pole odpovědí odpovídající každému jednotlivému požadavku v dávce. |
column
Sloupec tabulky.
Name | Typ | Description |
---|---|---|
name |
string |
Název tohoto sloupce |
type |
Datový typ tohoto sloupce. |
errorDetail
Podrobnosti o chybě.
Name | Typ | Description |
---|---|---|
additionalProperties |
object |
Další vlastnosti, které lze zadat u objektu podrobností o chybě |
code |
string |
Kód chyby. |
message |
string |
Chybová zpráva čitelná pro člověka. |
resources |
string[] |
Označuje prostředky, které byly zodpovědné za chybu. |
target |
string |
Určuje, která vlastnost v požadavku je za chybu zodpovědná. |
value |
string |
Určuje, která hodnota v cílovém objektu je zodpovědná za chybu. |
errorInfo
Kód a zpráva o chybě.
Name | Typ | Description |
---|---|---|
additionalProperties |
object |
Další vlastnosti, které je možné zadat u objektu informací o chybě |
code |
string |
Strojově čitelný kód chyby. |
details |
podrobnosti o chybě. |
|
innererror |
Kód a zpráva o chybě. |
|
message |
string |
Chybová zpráva čitelná pro člověka. |
errorResponse
Podrobnosti o chybě.
Name | Typ | Description |
---|---|---|
error |
Kód a zpráva o chybě. |
logsColumnType
Datový typ tohoto sloupce.
Name | Typ | Description |
---|---|---|
bool |
string |
|
datetime |
string |
|
decimal |
string |
|
dynamic |
string |
|
guid |
string |
|
int |
string |
|
long |
string |
|
real |
string |
|
string |
string |
|
timespan |
string |
methodType
Name | Typ | Description |
---|---|---|
POST |
string |
path
Name | Typ | Description |
---|---|---|
/query |
string |
queryBody
Analytický dotaz. Další informace o syntaxi analytických dotazů
Name | Typ | Description |
---|---|---|
query |
string |
Dotaz, který se má provést. |
timespan |
string |
Nepovinný parametr. Časový rozsah, pro který se má dotazovat na data. Jedná se o ISO8601 hodnotu časového období. Tento časový rozsah se použije kromě všech, které jsou zadané ve výrazu dotazu. |
workspaces |
string[] |
Seznam pracovních prostorů, které jsou součástí dotazu. |
Render
Vizualizační data ve formátu JSON.
Statistics
Statistika reprezentovaná ve formátu JSON
table
Tabulka odpovědí na dotaz
Name | Typ | Description |
---|---|---|
columns |
column[] |
Seznam sloupců v této tabulce |
name |
string |
Název tabulky. |
rows |
object[] |
Výsledné řádky z tohoto dotazu |