- 필수 기능
- 시작하기
- Glossary
- 표준 속성
- Guides
- Agent
- 통합
- 개방형텔레메트리
- 개발자
- Administrator's Guide
- API
- Datadog Mobile App
- CoScreen
- Cloudcraft
- 앱 내
- 서비스 관리
- 인프라스트럭처
- 애플리케이션 성능
- APM
- Continuous Profiler
- 스팬 시각화
- 데이터 스트림 모니터링
- 데이터 작업 모니터링
- 디지털 경험
- 소프트웨어 제공
- 보안
- AI Observability
- 로그 관리
- 관리
Manage configuration of log-based metrics for your organization.
GET https://api.ap1.datadoghq.com/api/v2/logs/config/metricshttps://api.datadoghq.eu/api/v2/logs/config/metricshttps://api.ddog-gov.com/api/v2/logs/config/metricshttps://api.datadoghq.com/api/v2/logs/config/metricshttps://api.us3.datadoghq.com/api/v2/logs/config/metricshttps://api.us5.datadoghq.com/api/v2/logs/config/metrics
Get the list of configured log-based metrics with their definitions.
This endpoint requires the logs_read_config
permission.
OK
All the available log-based metric objects.
항목
유형
설명
data
[object]
A list of log-based metric objects.
attributes
object
The object describing a Datadog log-based metric.
compute
object
The compute rule to compute the log-based metric.
aggregation_type
enum
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"
}
]
}
Not Authorized
API error response.
{
"errors": [
"Bad Request"
]
}
Too many requests
API error response.
{
"errors": [
"Bad Request"
]
}
// Get all log-based metrics returns "OK" response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.LogsMetricsApi;
import com.datadog.api.client.v2.model.LogsMetricsResponse;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
LogsMetricsApi apiInstance = new LogsMetricsApi(defaultClient);
try {
LogsMetricsResponse result = apiInstance.listLogsMetrics();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling LogsMetricsApi#listLogsMetrics");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
First install the library and its dependencies and then save the example to Example.java
and run following commands:
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
POST https://api.ap1.datadoghq.com/api/v2/logs/config/metricshttps://api.datadoghq.eu/api/v2/logs/config/metricshttps://api.ddog-gov.com/api/v2/logs/config/metricshttps://api.datadoghq.com/api/v2/logs/config/metricshttps://api.us3.datadoghq.com/api/v2/logs/config/metricshttps://api.us5.datadoghq.com/api/v2/logs/config/metrics
Create a metric based on your ingested logs in your organization.
Returns the log-based metric object from the request body when the request is successful.
This endpoint requires the logs_generate_metrics
permission.
The definition of the new log-based metric.
항목
유형
설명
data [required]
object
The new log-based metric properties.
attributes [required]
object
The object describing the Datadog log-based metric to create.
compute [required]
object
The compute rule to compute the log-based metric.
aggregation_type [required]
enum
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.
default: *
group_by
[object]
The rules for the group by.
path [required]
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 [required]
string
The name of the log-based metric.
type [required]
enum
The type of the resource. The value should always be logs_metrics.
Allowed enum values: logs_metrics
default: logs_metrics
{
"data": {
"id": "ExampleLogsMetric",
"type": "logs_metrics",
"attributes": {
"compute": {
"aggregation_type": "distribution",
"include_percentiles": true,
"path": "@duration"
}
}
}
}
OK
The log-based metric object.
항목
유형
설명
data
object
The log-based metric properties.
attributes
object
The object describing a Datadog log-based metric.
compute
object
The compute rule to compute the log-based metric.
aggregation_type
enum
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"
}
}
Bad Request
API error response.
{
"errors": [
"Bad Request"
]
}
Not Authorized
API error response.
{
"errors": [
"Bad Request"
]
}
Conflict
API error response.
{
"errors": [
"Bad Request"
]
}
Too many requests
API error response.
{
"errors": [
"Bad Request"
]
}
// Create a log-based metric returns "OK" response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.LogsMetricsApi;
import com.datadog.api.client.v2.model.LogsMetricCompute;
import com.datadog.api.client.v2.model.LogsMetricComputeAggregationType;
import com.datadog.api.client.v2.model.LogsMetricCreateAttributes;
import com.datadog.api.client.v2.model.LogsMetricCreateData;
import com.datadog.api.client.v2.model.LogsMetricCreateRequest;
import com.datadog.api.client.v2.model.LogsMetricResponse;
import com.datadog.api.client.v2.model.LogsMetricType;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
LogsMetricsApi apiInstance = new LogsMetricsApi(defaultClient);
LogsMetricCreateRequest body =
new LogsMetricCreateRequest()
.data(
new LogsMetricCreateData()
.id("ExampleLogsMetric")
.type(LogsMetricType.LOGS_METRICS)
.attributes(
new LogsMetricCreateAttributes()
.compute(
new LogsMetricCompute()
.aggregationType(LogsMetricComputeAggregationType.DISTRIBUTION)
.includePercentiles(true)
.path("@duration"))));
try {
LogsMetricResponse result = apiInstance.createLogsMetric(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling LogsMetricsApi#createLogsMetric");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
First install the library and its dependencies and then save the example to Example.java
and run following commands:
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
GET https://api.ap1.datadoghq.com/api/v2/logs/config/metrics/{metric_id}https://api.datadoghq.eu/api/v2/logs/config/metrics/{metric_id}https://api.ddog-gov.com/api/v2/logs/config/metrics/{metric_id}https://api.datadoghq.com/api/v2/logs/config/metrics/{metric_id}https://api.us3.datadoghq.com/api/v2/logs/config/metrics/{metric_id}https://api.us5.datadoghq.com/api/v2/logs/config/metrics/{metric_id}
Get a specific log-based metric from your organization.
This endpoint requires the logs_read_config
permission.
이름
유형
설명
metric_id [required]
string
The name of the log-based metric.
OK
The log-based metric object.
항목
유형
설명
data
object
The log-based metric properties.
attributes
object
The object describing a Datadog log-based metric.
compute
object
The compute rule to compute the log-based metric.
aggregation_type
enum
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"
}
}
Not Authorized
API error response.
{
"errors": [
"Bad Request"
]
}
Not Found
API error response.
{
"errors": [
"Bad Request"
]
}
Too many requests
API error response.
{
"errors": [
"Bad Request"
]
}
// Get a log-based metric returns "OK" response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.LogsMetricsApi;
import com.datadog.api.client.v2.model.LogsMetricResponse;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
LogsMetricsApi apiInstance = new LogsMetricsApi(defaultClient);
// there is a valid "logs_metric" in the system
String LOGS_METRIC_DATA_ID = System.getenv("LOGS_METRIC_DATA_ID");
try {
LogsMetricResponse result = apiInstance.getLogsMetric(LOGS_METRIC_DATA_ID);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling LogsMetricsApi#getLogsMetric");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
First install the library and its dependencies and then save the example to Example.java
and run following commands:
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
PATCH https://api.ap1.datadoghq.com/api/v2/logs/config/metrics/{metric_id}https://api.datadoghq.eu/api/v2/logs/config/metrics/{metric_id}https://api.ddog-gov.com/api/v2/logs/config/metrics/{metric_id}https://api.datadoghq.com/api/v2/logs/config/metrics/{metric_id}https://api.us3.datadoghq.com/api/v2/logs/config/metrics/{metric_id}https://api.us5.datadoghq.com/api/v2/logs/config/metrics/{metric_id}
Update a specific log-based metric from your organization.
Returns the log-based metric object from the request body when the request is successful.
This endpoint requires the logs_generate_metrics
permission.
이름
유형
설명
metric_id [required]
string
The name of the log-based metric.
New definition of the log-based metric.
항목
유형
설명
data [required]
object
The new log-based metric properties.
attributes [required]
object
The log-based metric properties that will be updated.
compute
object
The compute rule to compute the log-based metric.
include_percentiles
boolean
Toggle to include or exclude percentile aggregations for distribution metrics.
Only present when the aggregation_type
is 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.
default: *
group_by
[object]
The rules for the group by.
path [required]
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.
type [required]
enum
The type of the resource. The value should always be logs_metrics.
Allowed enum values: logs_metrics
default: logs_metrics
{
"data": {
"type": "logs_metrics",
"attributes": {
"filter": {
"query": "service:web* AND @http.status_code:[200 TO 299]-updated"
}
}
}
}
{
"data": {
"type": "logs_metrics",
"attributes": {
"compute": {
"include_percentiles": false
}
}
}
}
OK
The log-based metric object.
항목
유형
설명
data
object
The log-based metric properties.
attributes
object
The object describing a Datadog log-based metric.
compute
object
The compute rule to compute the log-based metric.
aggregation_type
enum
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"
}
}
Bad Request
API error response.
{
"errors": [
"Bad Request"
]
}
Not Authorized
API error response.
{
"errors": [
"Bad Request"
]
}
Not Found
API error response.
{
"errors": [
"Bad Request"
]
}
Too many requests
API error response.
{
"errors": [
"Bad Request"
]
}
// Update a log-based metric returns "OK" response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.LogsMetricsApi;
import com.datadog.api.client.v2.model.LogsMetricFilter;
import com.datadog.api.client.v2.model.LogsMetricResponse;
import com.datadog.api.client.v2.model.LogsMetricType;
import com.datadog.api.client.v2.model.LogsMetricUpdateAttributes;
import com.datadog.api.client.v2.model.LogsMetricUpdateData;
import com.datadog.api.client.v2.model.LogsMetricUpdateRequest;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
LogsMetricsApi apiInstance = new LogsMetricsApi(defaultClient);
// there is a valid "logs_metric" in the system
String LOGS_METRIC_DATA_ATTRIBUTES_FILTER_QUERY =
System.getenv("LOGS_METRIC_DATA_ATTRIBUTES_FILTER_QUERY");
String LOGS_METRIC_DATA_ID = System.getenv("LOGS_METRIC_DATA_ID");
LogsMetricUpdateRequest body =
new LogsMetricUpdateRequest()
.data(
new LogsMetricUpdateData()
.type(LogsMetricType.LOGS_METRICS)
.attributes(
new LogsMetricUpdateAttributes()
.filter(
new LogsMetricFilter()
.query(
"service:web* AND @http.status_code:[200 TO"
+ " 299]-updated"))));
try {
LogsMetricResponse result = apiInstance.updateLogsMetric(LOGS_METRIC_DATA_ID, body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling LogsMetricsApi#updateLogsMetric");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
// Update a log-based metric with include_percentiles field returns "OK" response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.LogsMetricsApi;
import com.datadog.api.client.v2.model.LogsMetricResponse;
import com.datadog.api.client.v2.model.LogsMetricType;
import com.datadog.api.client.v2.model.LogsMetricUpdateAttributes;
import com.datadog.api.client.v2.model.LogsMetricUpdateCompute;
import com.datadog.api.client.v2.model.LogsMetricUpdateData;
import com.datadog.api.client.v2.model.LogsMetricUpdateRequest;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
LogsMetricsApi apiInstance = new LogsMetricsApi(defaultClient);
// there is a valid "logs_metric_percentile" in the system
String LOGS_METRIC_PERCENTILE_DATA_ID = System.getenv("LOGS_METRIC_PERCENTILE_DATA_ID");
LogsMetricUpdateRequest body =
new LogsMetricUpdateRequest()
.data(
new LogsMetricUpdateData()
.type(LogsMetricType.LOGS_METRICS)
.attributes(
new LogsMetricUpdateAttributes()
.compute(new LogsMetricUpdateCompute().includePercentiles(false))));
try {
LogsMetricResponse result =
apiInstance.updateLogsMetric(LOGS_METRIC_PERCENTILE_DATA_ID, body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling LogsMetricsApi#updateLogsMetric");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
First install the library and its dependencies and then save the example to Example.java
and run following commands:
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
DELETE https://api.ap1.datadoghq.com/api/v2/logs/config/metrics/{metric_id}https://api.datadoghq.eu/api/v2/logs/config/metrics/{metric_id}https://api.ddog-gov.com/api/v2/logs/config/metrics/{metric_id}https://api.datadoghq.com/api/v2/logs/config/metrics/{metric_id}https://api.us3.datadoghq.com/api/v2/logs/config/metrics/{metric_id}https://api.us5.datadoghq.com/api/v2/logs/config/metrics/{metric_id}
Delete a specific log-based metric from your organization.
This endpoint requires the logs_generate_metrics
permission.
이름
유형
설명
metric_id [required]
string
The name of the log-based metric.
OK
Not Authorized
API error response.
{
"errors": [
"Bad Request"
]
}
Not Found
API error response.
{
"errors": [
"Bad Request"
]
}
Too many requests
API error response.
{
"errors": [
"Bad Request"
]
}
// Delete a log-based metric returns "OK" response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.LogsMetricsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
LogsMetricsApi apiInstance = new LogsMetricsApi(defaultClient);
// there is a valid "logs_metric" in the system
String LOGS_METRIC_DATA_ID = System.getenv("LOGS_METRIC_DATA_ID");
try {
apiInstance.deleteLogsMetric(LOGS_METRIC_DATA_ID);
} catch (ApiException e) {
System.err.println("Exception when calling LogsMetricsApi#deleteLogsMetric");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
First install the library and its dependencies and then save the example to Example.java
and run following commands:
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"