The type of aggregation to use.
Allowed enum values: count,distribution
include_percentiles
boolean
Toggle to include or exclude percentile aggregations for distribution metrics.
Only present when the aggregation_type is distribution.
path
string
The path to the value the log-based metric will aggregate on (only used if the aggregation type is a "distribution").
filter
object
The log-based metric filter. Logs matching this filter will be aggregated in this metric.
query
string
The search query - following the log search syntax.
group_by
[object]
The rules for the group by.
path
string
The path to the value the log-based metric will be aggregated over.
tag_name
string
Eventual name of the tag that gets created. By default, the path attribute is used as the tag name.
id
string
The name of the log-based metric.
type
enum
The type of the resource. The value should always be logs_metrics.
Allowed enum values: logs_metrics
default: logs_metrics
{"data":[{"attributes":{"compute":{"aggregation_type":"distribution","include_percentiles":true,"path":"@duration"},"filter":{"query":"service:web* AND @http.status_code:[200 TO 299]"},"group_by":[{"path":"@http.status_code","tag_name":"status_code"}]},"id":"logs.page.load.count","type":"logs_metrics"}]}
"""
Get all log-based metrics returns "OK" response
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.logs_metrics_apiimportLogsMetricsApiconfiguration=Configuration()withApiClient(configuration)asapi_client:api_instance=LogsMetricsApi(api_client)response=api_instance.list_logs_metrics()print(response)
# Get all log-based metrics returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::LogsMetricsAPI.newpapi_instance.list_logs_metrics()
// Get all log-based metrics returns "OK" responsepackagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV2")funcmain(){ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewLogsMetricsApi(apiClient)resp,r,err:=api.ListLogsMetrics(ctx)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `LogsMetricsApi.ListLogsMetrics`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `LogsMetricsApi.ListLogsMetrics`:\n%s\n",responseContent)}
// Get all log-based metrics returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_logs_metrics::LogsMetricsAPI;#[tokio::main]asyncfnmain(){letconfiguration=datadog::Configuration::new();letapi=LogsMetricsAPI::with_config(configuration);letresp=api.list_logs_metrics().await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_API_KEY="<API-KEY>"DD_APP_KEY="<APP-KEY>"cargo run
/**
* Get all log-based metrics returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.LogsMetricsApi(configuration);apiInstance.listLogsMetrics().then((data: v2.LogsMetricsResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));