Get hourly usage for analyzed logs (Security Monitoring).
Note: This endpoint has been deprecated. Hourly usage data for all products is now available in the Get hourly usage by product family API. Refer to Migrating from the V1 Hourly Usage APIs to V2 for the associated migration guide.
This endpoint requires the usage_read permission.
OAuth apps require the usage_read authorization scope to access this endpoint.
Arguments
Query Strings
Name
Type
Description
start_hr [required]
string
Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.
end_hr
string
Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending
before this hour.
# Get hourly usage for analyzed logs returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V1::UsageMeteringAPI.newopts={end_hr:(Time.now+-3*86400),}papi_instance.get_usage_analyzed_logs((Time.now+-5*86400),opts)
// Get hourly usage for analyzed logs returns "OK" responsepackagemainimport("context""encoding/json""fmt""os""time""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV1")funcmain(){ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV1.NewUsageMeteringApi(apiClient)resp,r,err:=api.GetUsageAnalyzedLogs(ctx,time.Now().AddDate(0,0,-5),*datadogV1.NewGetUsageAnalyzedLogsOptionalParameters().WithEndHr(time.Now().AddDate(0,0,-3)))iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `UsageMeteringApi.GetUsageAnalyzedLogs`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `UsageMeteringApi.GetUsageAnalyzedLogs`:\n%s\n",responseContent)}
// Get hourly usage for analyzed logs returns "OK" response
usechrono::{DateTime,Utc};usedatadog_api_client::datadog;usedatadog_api_client::datadogV1::api_usage_metering::GetUsageAnalyzedLogsOptionalParams;usedatadog_api_client::datadogV1::api_usage_metering::UsageMeteringAPI;#[tokio::main]asyncfnmain(){letconfiguration=datadog::Configuration::new();letapi=UsageMeteringAPI::with_config(configuration);letresp=api.get_usage_analyzed_logs(DateTime::parse_from_rfc3339("2021-11-06T11:11:11+00:00").expect("Failed to parse datetime").with_timezone(&Utc),GetUsageAnalyzedLogsOptionalParams::default().end_hr(DateTime::parse_from_rfc3339("2021-11-08T11:11:11+00:00").expect("Failed to parse datetime").with_timezone(&Utc),),).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="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Get hourly usage for analyzed logs returns "OK" response
*/import{client,v1}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv1.UsageMeteringApi(configuration);constparams: v1.UsageMeteringApiGetUsageAnalyzedLogsRequest={startHr: newDate(newDate().getTime()+-5*86400*1000),endHr: newDate(newDate().getTime()+-3*86400*1000),};apiInstance.getUsageAnalyzedLogs(params).then((data: v1.UsageAnalyzedLogsResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));