Skip to content

Commit 84cff26

Browse files
authored
{LogAnalytics} Fix 'az monitor log-analytics query' examples (Azure#3016)
* Fix 'az monitor log-analytics query' examples * recored test again
1 parent abc3847 commit 84cff26

File tree

2 files changed

+22
-26
lines changed

2 files changed

+22
-26
lines changed

src/log-analytics/azext_loganalytics/_help.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
examples:
1919
- name: Execute a simple query over past 3.5 days.
2020
text: |
21-
az monitor log-analytics query -w workspace-customId --analytics-query "AzureActivity | summarize count() by bin(timestamp, 1h)" -t P3DT12H
21+
az monitor log-analytics query -w workspace-customId --analytics-query "AzureActivity | summarize count() by bin(TimeGenerated, 1h)" -t P3DT12H
2222
- name: Execute a saved query in workspace
2323
text: |
2424
QUERY=$(az monitor log-analytics workspace saved-search show -g resource-group --workspace-name workspace-name -n query-name --query query --output tsv)

src/log-analytics/azext_loganalytics/tests/latest/recordings/test_query.yaml

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -15,30 +15,27 @@ interactions:
1515
Content-Length:
1616
- '177'
1717
Content-Type:
18-
- application/json; charset=utf-8
18+
- application/json
1919
ParameterSetName:
2020
- -g -n --location --quota --level --sku
2121
User-Agent:
22-
- python/3.8.5 (Windows-10-10.0.19041-SP0) msrest/0.6.18 msrest_azure/0.6.3
23-
azure-mgmt-loganalytics/0.7.0 Azure-SDK-For-Python AZURECLI/2.17.0
24-
accept-language:
25-
- en-US
22+
- AZURECLI/2.19.1 azsdk-python-mgmt-loganalytics/8.0.0 Python/3.8.5 (Windows-10-10.0.19041-SP0)
2623
method: PUT
27-
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_log_analytics000001/providers/Microsoft.OperationalInsights/workspaces/clitest000002?api-version=2020-03-01-preview
24+
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_log_analytics000001/providers/Microsoft.OperationalInsights/workspaces/clitest000002?api-version=2020-08-01
2825
response:
2926
body:
3027
string: "{\r\n \"properties\": {\r\n \"source\": \"Azure\",\r\n \"customerId\":
31-
\"fad18499-958d-48d0-ae36-0bece90e1f50\",\r\n \"provisioningState\": \"Creating\",\r\n
28+
\"514eb233-d846-49be-8715-84e2a9244560\",\r\n \"provisioningState\": \"Creating\",\r\n
3229
\ \"sku\": {\r\n \"name\": \"capacityreservation\",\r\n \"capacityReservationLevel\":
3330
100,\r\n \"maxCapacityReservationLevel\": 3000,\r\n \"lastSkuUpdate\":
34-
\"Wed, 30 Dec 2020 10:22:17 GMT\"\r\n },\r\n \"retentionInDays\": 30,\r\n
31+
\"Tue, 23 Feb 2021 07:07:52 GMT\"\r\n },\r\n \"retentionInDays\": 30,\r\n
3532
\ \"features\": {\r\n \"legacy\": 0,\r\n \"searchVersion\": 1,\r\n
3633
\ \"enableLogAccessUsingOnlyResourcePermissions\": true\r\n },\r\n
3734
\ \"workspaceCapping\": {\r\n \"dailyQuotaGb\": -1.0,\r\n \"quotaNextResetTime\":
38-
\"Thu, 31 Dec 2020 09:00:00 GMT\",\r\n \"dataIngestionStatus\": \"RespectQuota\"\r\n
35+
\"Wed, 24 Feb 2021 06:00:00 GMT\",\r\n \"dataIngestionStatus\": \"RespectQuota\"\r\n
3936
\ },\r\n \"publicNetworkAccessForIngestion\": \"Enabled\",\r\n \"publicNetworkAccessForQuery\":
40-
\"Enabled\",\r\n \"createdDate\": \"Wed, 30 Dec 2020 10:22:17 GMT\",\r\n
41-
\ \"modifiedDate\": \"Wed, 30 Dec 2020 10:22:17 GMT\"\r\n },\r\n \"id\":
37+
\"Enabled\",\r\n \"createdDate\": \"Tue, 23 Feb 2021 07:07:52 GMT\",\r\n
38+
\ \"modifiedDate\": \"Tue, 23 Feb 2021 07:07:52 GMT\"\r\n },\r\n \"id\":
4239
\"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_log_analytics000001/providers/microsoft.operationalinsights/workspaces/clitest000002\",\r\n
4340
\ \"name\": \"clitest000002\",\r\n \"type\": \"Microsoft.OperationalInsights/workspaces\",\r\n
4441
\ \"location\": \"eastus\"\r\n}"
@@ -50,7 +47,7 @@ interactions:
5047
content-type:
5148
- application/json
5249
date:
53-
- Wed, 30 Dec 2020 10:22:19 GMT
50+
- Tue, 23 Feb 2021 07:07:53 GMT
5451
pragma:
5552
- no-cache
5653
server:
@@ -72,7 +69,7 @@ interactions:
7269
body: null
7370
headers:
7471
Accept:
75-
- application/json
72+
- '*/*'
7673
Accept-Encoding:
7774
- gzip, deflate
7875
CommandName:
@@ -82,24 +79,23 @@ interactions:
8279
ParameterSetName:
8380
- -g -n --location --quota --level --sku
8481
User-Agent:
85-
- python/3.8.5 (Windows-10-10.0.19041-SP0) msrest/0.6.18 msrest_azure/0.6.3
86-
azure-mgmt-loganalytics/0.7.0 Azure-SDK-For-Python AZURECLI/2.17.0
82+
- AZURECLI/2.19.1 azsdk-python-mgmt-loganalytics/8.0.0 Python/3.8.5 (Windows-10-10.0.19041-SP0)
8783
method: GET
88-
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_log_analytics000001/providers/Microsoft.OperationalInsights/workspaces/clitest000002?api-version=2020-03-01-preview
84+
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_log_analytics000001/providers/Microsoft.OperationalInsights/workspaces/clitest000002?api-version=2020-08-01
8985
response:
9086
body:
9187
string: "{\r\n \"properties\": {\r\n \"source\": \"Azure\",\r\n \"customerId\":
92-
\"fad18499-958d-48d0-ae36-0bece90e1f50\",\r\n \"provisioningState\": \"Succeeded\",\r\n
88+
\"514eb233-d846-49be-8715-84e2a9244560\",\r\n \"provisioningState\": \"Succeeded\",\r\n
9389
\ \"sku\": {\r\n \"name\": \"capacityreservation\",\r\n \"capacityReservationLevel\":
9490
100,\r\n \"maxCapacityReservationLevel\": 3000,\r\n \"lastSkuUpdate\":
95-
\"Wed, 30 Dec 2020 10:22:17 GMT\"\r\n },\r\n \"retentionInDays\": 30,\r\n
91+
\"Tue, 23 Feb 2021 07:07:52 GMT\"\r\n },\r\n \"retentionInDays\": 30,\r\n
9692
\ \"features\": {\r\n \"legacy\": 0,\r\n \"searchVersion\": 1,\r\n
9793
\ \"enableLogAccessUsingOnlyResourcePermissions\": true\r\n },\r\n
9894
\ \"workspaceCapping\": {\r\n \"dailyQuotaGb\": 1.0,\r\n \"quotaNextResetTime\":
99-
\"Thu, 31 Dec 2020 09:00:00 GMT\",\r\n \"dataIngestionStatus\": \"RespectQuota\"\r\n
95+
\"Wed, 24 Feb 2021 06:00:00 GMT\",\r\n \"dataIngestionStatus\": \"RespectQuota\"\r\n
10096
\ },\r\n \"publicNetworkAccessForIngestion\": \"Enabled\",\r\n \"publicNetworkAccessForQuery\":
101-
\"Enabled\",\r\n \"createdDate\": \"Wed, 30 Dec 2020 10:22:17 GMT\",\r\n
102-
\ \"modifiedDate\": \"Wed, 30 Dec 2020 10:22:18 GMT\"\r\n },\r\n \"id\":
97+
\"Enabled\",\r\n \"createdDate\": \"Tue, 23 Feb 2021 07:07:52 GMT\",\r\n
98+
\ \"modifiedDate\": \"Tue, 23 Feb 2021 07:07:53 GMT\"\r\n },\r\n \"id\":
10399
\"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_log_analytics000001/providers/microsoft.operationalinsights/workspaces/clitest000002\",\r\n
104100
\ \"name\": \"clitest000002\",\r\n \"type\": \"Microsoft.OperationalInsights/workspaces\",\r\n
105101
\ \"location\": \"eastus\"\r\n}"
@@ -111,7 +107,7 @@ interactions:
111107
content-type:
112108
- application/json
113109
date:
114-
- Wed, 30 Dec 2020 10:22:50 GMT
110+
- Tue, 23 Feb 2021 07:08:24 GMT
115111
pragma:
116112
- no-cache
117113
server:
@@ -147,7 +143,7 @@ interactions:
147143
User-Agent:
148144
- python/3.8.5 (Windows-10-10.0.19041-SP0) msrest/0.6.18 azure-loganalytics/0.1.0
149145
method: POST
150-
uri: https://api.loganalytics.io/v1/workspaces/fad18499-958d-48d0-ae36-0bece90e1f50/query
146+
uri: https://api.loganalytics.io/v1/workspaces/514eb233-d846-49be-8715-84e2a9244560/query
151147
response:
152148
body:
153149
string: '{"tables":[{"name":"getschema","columns":[{"name":"ColumnName","type":"string"},{"name":"ColumnOrdinal","type":"int"},{"name":"DataType","type":"string"},{"name":"ColumnType","type":"string"}],"rows":[["TenantId",0,"System.String","string"],["SourceSystem",1,"System.String","string"],["TimeGenerated",2,"System.DateTime","datetime"],["MG",3,"System.String","string"],["ManagementGroupName",4,"System.String","string"],["SourceComputerId",5,"System.String","string"],["ComputerIP",6,"System.String","string"],["Computer",7,"System.String","string"],["Category",8,"System.String","string"],["OSType",9,"System.String","string"],["OSName",10,"System.String","string"],["OSMajorVersion",11,"System.String","string"],["OSMinorVersion",12,"System.String","string"],["Version",13,"System.String","string"],["SCAgentChannel",14,"System.String","string"],["IsGatewayInstalled",15,"System.SByte","bool"],["RemoteIPLongitude",16,"System.Double","real"],["RemoteIPLatitude",17,"System.Double","real"],["RemoteIPCountry",18,"System.String","string"],["SubscriptionId",19,"System.String","string"],["ResourceGroup",20,"System.String","string"],["ResourceProvider",21,"System.String","string"],["Resource",22,"System.String","string"],["ResourceId",23,"System.String","string"],["ResourceType",24,"System.String","string"],["ComputerEnvironment",25,"System.String","string"],["Solutions",26,"System.String","string"],["VMUUID",27,"System.String","string"],["Type",28,"System.String","string"],["_ResourceId",29,"System.String","string"]]}]}'
@@ -163,15 +159,15 @@ interactions:
163159
content-type:
164160
- application/json; charset=utf-8
165161
date:
166-
- Wed, 30 Dec 2020 10:22:53 GMT
162+
- Tue, 23 Feb 2021 07:08:29 GMT
167163
strict-transport-security:
168164
- max-age=15724800; includeSubDomains
169165
transfer-encoding:
170166
- chunked
171167
vary:
172168
- Accept-Encoding
173169
via:
174-
- 1.1 draft-oms-7d684489b6-hfrdr
170+
- 1.1 draft-oms-c6dfd9d4c-h6h7p
175171
x-content-type-options:
176172
- nosniff
177173
status:

0 commit comments

Comments
 (0)