Belirli bir Log Analytics Çalışma Alanı için kaydedilen aramaları alır
GET https://management.azure.com/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/savedSearches?api-version=2020-08-01
URI Parametreleri
Name |
İçinde |
Gerekli |
Tür |
Description |
resourceGroupName
|
path |
True
|
string
|
Kaynak grubunun adı. Ad büyük/küçük harfe duyarlı değildir.
|
subscriptionId
|
path |
True
|
string
|
Hedef aboneliğin kimliği.
|
workspaceName
|
path |
True
|
string
|
Çalışma alanının adı.
Regex pattern: ^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$
|
api-version
|
query |
True
|
string
|
Bu işlem için kullanılacak API sürümü.
|
Yanıtlar
Name |
Tür |
Description |
200 OK
|
SavedSearchesListResult
|
Verilen Log Analytics Çalışma Alanı için kaydedilen aramaların listesini döndürür.
|
Güvenlik
azure_auth
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
SavedSearchesList
Sample Request
GET https://management.azure.com/subscriptions/00000000-0000-0000-0000-00000000000/resourcegroups/TestRG/providers/Microsoft.OperationalInsights/workspaces/TestWS/savedSearches?api-version=2020-08-01
/** Samples for SavedSearches ListByWorkspace. */
public final class Main {
/*
* x-ms-original-file: specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/stable/2020-08-01/examples/SavedSearchesListByWorkspace.json
*/
/**
* Sample code: SavedSearchesList.
*
* @param manager Entry point to LogAnalyticsManager.
*/
public static void savedSearchesList(com.azure.resourcemanager.loganalytics.LogAnalyticsManager manager) {
manager.savedSearches().listByWorkspaceWithResponse("TestRG", "TestWS", com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.loganalytics import LogAnalyticsManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-loganalytics
# USAGE
python saved_searches_list_by_workspace.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = LogAnalyticsManagementClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-00000000000",
)
response = client.saved_searches.list_by_workspace(
resource_group_name="TestRG",
workspace_name="TestWS",
)
print(response)
# x-ms-original-file: specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/stable/2020-08-01/examples/SavedSearchesListByWorkspace.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armoperationalinsights_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/operationalinsights/armoperationalinsights"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/stable/2020-08-01/examples/SavedSearchesListByWorkspace.json
func ExampleSavedSearchesClient_ListByWorkspace() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armoperationalinsights.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewSavedSearchesClient().ListByWorkspace(ctx, "TestRG", "TestWS", nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.SavedSearchesListResult = armoperationalinsights.SavedSearchesListResult{
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { OperationalInsightsManagementClient } = require("@azure/arm-operationalinsights");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Gets the saved searches for a given Log Analytics Workspace
*
* @summary Gets the saved searches for a given Log Analytics Workspace
* x-ms-original-file: specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/stable/2020-08-01/examples/SavedSearchesListByWorkspace.json
*/
async function savedSearchesList() {
const subscriptionId =
process.env["OPERATIONALINSIGHTS_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-00000000000";
const resourceGroupName = process.env["OPERATIONALINSIGHTS_RESOURCE_GROUP"] || "TestRG";
const workspaceName = "TestWS";
const credential = new DefaultAzureCredential();
const client = new OperationalInsightsManagementClient(credential, subscriptionId);
const result = await client.savedSearches.listByWorkspace(resourceGroupName, workspaceName);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.OperationalInsights;
using Azure.ResourceManager.OperationalInsights.Models;
// Generated from example definition: specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/stable/2020-08-01/examples/SavedSearchesListByWorkspace.json
// this example is just showing the usage of "SavedSearches_ListByWorkspace" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this OperationalInsightsWorkspaceResource created on azure
// for more information of creating OperationalInsightsWorkspaceResource, please refer to the document of OperationalInsightsWorkspaceResource
string subscriptionId = "00000000-0000-0000-0000-00000000000";
string resourceGroupName = "TestRG";
string workspaceName = "TestWS";
ResourceIdentifier operationalInsightsWorkspaceResourceId = OperationalInsightsWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName);
OperationalInsightsWorkspaceResource operationalInsightsWorkspace = client.GetOperationalInsightsWorkspaceResource(operationalInsightsWorkspaceResourceId);
// get the collection of this OperationalInsightsSavedSearchResource
OperationalInsightsSavedSearchCollection collection = operationalInsightsWorkspace.GetOperationalInsightsSavedSearches();
// invoke the operation and iterate over the result
await foreach (OperationalInsightsSavedSearchResource item in collection.GetAllAsync())
{
// the variable item is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
OperationalInsightsSavedSearchData resourceData = item.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
}
Console.WriteLine($"Succeeded");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
[
{
"id": "subscriptions/00000000-0000-0000-0000-000000000005/resourceGroups/mms-eus/providers/Microsoft.OperationalInsights/workspaces/AtlantisDemo/savedSearches/test-new-saved-search-id-2015",
"etag": "W/\"datetime'2017-10-02T23%3A15%3A41.0709875Z'\"",
"properties": {
"Category": " Saved Search Test Category",
"DisplayName": "Create or Update Saved Search Test",
"Query": "* | measure Count() by Computer",
"Tags": [
{
"Name": "Group",
"Value": "Computer"
}
],
"Version": 1
}
}
]
Tanımlar
SavedSearch
Kaydedilen arama sonuçları için değer nesnesi.
Name |
Tür |
Description |
etag
|
string
|
Kaydedilen aramanın ETag'i. Mevcut kaydedilmiş aramayı geçersiz kılmak için "*" kullanın veya geçerli Etag'i belirtin
|
id
|
string
|
Kaynağın tam kaynak kimliği. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
name
|
string
|
Kaynağın adı
|
properties.category
|
string
|
Kaydedilen aramanın kategorisi. Bu, kullanıcının kaydedilmiş bir aramayı daha hızlı bulmasına yardımcı olur.
|
properties.displayName
|
string
|
Kaydedilen arama görünen adı.
|
properties.functionAlias
|
string
|
Sorgu bir işlev işlevi görürse işlev diğer adı.
|
properties.functionParameters
|
string
|
Sorgu bir işlev işlevi görecekse isteğe bağlı işlev parametreleri. Değer şu biçimde olmalıdır: 'param-name1:type1 = default_value1, param-name2:type2 = default_value2'. Daha fazla örnek ve doğru söz dizimi için bkz https://docs.microsoft.com/en-us/azure/kusto/query/functions/user-defined-functions. .
|
properties.query
|
string
|
Kaydedilen aramanın sorgu ifadesi.
|
properties.tags
|
Tag[]
|
Kaydedilen aramaya eklenen etiketler.
|
properties.version
|
integer
|
Sorgu dilinin sürüm numarası. Geçerli sürüm 2'dir ve varsayılan sürümdür.
|
type
|
string
|
Kaynağın türü. Örneğin, "Microsoft.Compute/virtualMachines" veya "Microsoft.Storage/storageAccounts"
|
SavedSearchesListResult
Kaydedilen arama listesi işlemi yanıtı.
Name |
Tür |
Description |
value
|
SavedSearch[]
|
Sonuç değerleri dizisi.
|
Tag
Kaydedilen aramanın etiketi.
Name |
Tür |
Description |
name
|
string
|
Etiket adı.
|
value
|
string
|
Etiket değeri.
|