Índices de logs

Gestiona la configuración de índices de logs.

GET https://api.ap1.datadoghq.com/api/v1/logs/config/indexeshttps://api.datadoghq.eu/api/v1/logs/config/indexeshttps://api.ddog-gov.com/api/v1/logs/config/indexeshttps://api.datadoghq.com/api/v1/logs/config/indexeshttps://api.us3.datadoghq.com/api/v1/logs/config/indexeshttps://api.us5.datadoghq.com/api/v1/logs/config/indexes

Información general

El objeto Índice describe la configuración de un índice de logs. Este endpoint devuelve una matriz de objetos LogIndex de tu organización. This endpoint requires the logs_read_config permission.

Respuesta

OK

Object with all Index configurations for a given organization.

Expand All

Campo

Tipo

Descripción

indexes

[object]

Array of Log index configurations.

daily_limit

int64

The number of log events you can send in this index per day before you are rate-limited.

daily_limit_reset

object

Object containing options to override the default daily limit reset time.

reset_time

string

String in HH:00 format representing the time of day the daily limit should be reset. The hours must be between 00 and 23 (inclusive).

reset_utc_offset

string

String in (-|+)HH:00 format representing the UTC offset to apply to the given reset time. The hours must be between -12 and +14 (inclusive).

daily_limit_warning_threshold_percentage

double

A percentage threshold of the daily quota at which a Datadog warning event is generated.

exclusion_filters

[object]

An array of exclusion objects. The logs are tested against the query of each filter, following the order of the array. Only the first matching active exclusion matters, others (if any) are ignored.

filter

object

Exclusion filter is defined by a query, a sampling rule, and a active/inactive toggle.

query

string

Default query is *, meaning all logs flowing in the index would be excluded. Scope down exclusion filter to only a subset of logs with a log query.

sample_rate [required]

double

Sample rate to apply to logs going through this exclusion filter, a value of 1.0 excludes all logs matching the query.

is_enabled

boolean

Whether or not the exclusion filter is active.

name [required]

string

Name of the index exclusion filter.

filter [required]

object

Filter for logs.

query

string

The filter query.

is_rate_limited

boolean

A boolean stating if the index is rate limited, meaning more logs than the daily limit have been sent. Rate limit is reset every-day at 2pm UTC.

name [required]

string

The name of the index.

num_flex_logs_retention_days

int64

The total number of days logs are stored in Standard and Flex Tier before being deleted from the index. If Standard Tier is enabled on this index, logs are first retained in Standard Tier for the number of days specified through num_retention_days, and then stored in Flex Tier until the number of days specified in num_flex_logs_retention_days is reached. The available values depend on retention plans specified in your organization's contract/subscriptions.

num_retention_days

int64

The number of days logs are stored in Standard Tier before aging into the Flex Tier or being deleted from the index. The available values depend on retention plans specified in your organization's contract/subscriptions.

{
  "indexes": [
    {
      "daily_limit": 300000000,
      "daily_limit_reset": {
        "reset_time": "14:00",
        "reset_utc_offset": "+02:00"
      },
      "daily_limit_warning_threshold_percentage": 70,
      "exclusion_filters": [
        {
          "filter": {
            "query": "*",
            "sample_rate": 1
          },
          "is_enabled": false,
          "name": "payment"
        }
      ],
      "filter": {
        "query": "source:python"
      },
      "is_rate_limited": false,
      "name": "main",
      "num_flex_logs_retention_days": 360,
      "num_retention_days": 15
    }
  ]
}

Forbidden

Error response object.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Too many requests

Error response object.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Ejemplo de código

// Get all indexes returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.LogsIndexesApi;
import com.datadog.api.client.v1.model.LogsIndexListResponse;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    LogsIndexesApi apiInstance = new LogsIndexesApi(defaultClient);

    try {
      LogsIndexListResponse result = apiInstance.listLogIndexes();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling LogsIndexesApi#listLogIndexes");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

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="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"

GET https://api.ap1.datadoghq.com/api/v1/logs/config/indexes/{name}https://api.datadoghq.eu/api/v1/logs/config/indexes/{name}https://api.ddog-gov.com/api/v1/logs/config/indexes/{name}https://api.datadoghq.com/api/v1/logs/config/indexes/{name}https://api.us3.datadoghq.com/api/v1/logs/config/indexes/{name}https://api.us5.datadoghq.com/api/v1/logs/config/indexes/{name}

Información general

Obtén un índice de logs de tu organización. Este endpoint no recibe argumentos JSON. This endpoint requires the logs_read_config permission.

Argumentos

Parámetros de ruta

Nombre

Tipo

Descripción

name [required]

string

Name of the log index.

Respuesta

OK

Object describing a Datadog Log index.

Expand All

Campo

Tipo

Descripción

daily_limit

int64

The number of log events you can send in this index per day before you are rate-limited.

daily_limit_reset

object

Object containing options to override the default daily limit reset time.

reset_time

string

String in HH:00 format representing the time of day the daily limit should be reset. The hours must be between 00 and 23 (inclusive).

reset_utc_offset

string

String in (-|+)HH:00 format representing the UTC offset to apply to the given reset time. The hours must be between -12 and +14 (inclusive).

daily_limit_warning_threshold_percentage

double

A percentage threshold of the daily quota at which a Datadog warning event is generated.

exclusion_filters

[object]

An array of exclusion objects. The logs are tested against the query of each filter, following the order of the array. Only the first matching active exclusion matters, others (if any) are ignored.

filter

object

Exclusion filter is defined by a query, a sampling rule, and a active/inactive toggle.

query

string

Default query is *, meaning all logs flowing in the index would be excluded. Scope down exclusion filter to only a subset of logs with a log query.

sample_rate [required]

double

Sample rate to apply to logs going through this exclusion filter, a value of 1.0 excludes all logs matching the query.

is_enabled

boolean

Whether or not the exclusion filter is active.

name [required]

string

Name of the index exclusion filter.

filter [required]

object

Filter for logs.

query

string

The filter query.

is_rate_limited

boolean

A boolean stating if the index is rate limited, meaning more logs than the daily limit have been sent. Rate limit is reset every-day at 2pm UTC.

name [required]

string

The name of the index.

num_flex_logs_retention_days

int64

The total number of days logs are stored in Standard and Flex Tier before being deleted from the index. If Standard Tier is enabled on this index, logs are first retained in Standard Tier for the number of days specified through num_retention_days, and then stored in Flex Tier until the number of days specified in num_flex_logs_retention_days is reached. The available values depend on retention plans specified in your organization's contract/subscriptions.

num_retention_days

int64

The number of days logs are stored in Standard Tier before aging into the Flex Tier or being deleted from the index. The available values depend on retention plans specified in your organization's contract/subscriptions.

{
  "daily_limit": 300000000,
  "daily_limit_reset": {
    "reset_time": "14:00",
    "reset_utc_offset": "+02:00"
  },
  "daily_limit_warning_threshold_percentage": 70,
  "exclusion_filters": [
    {
      "filter": {
        "query": "*",
        "sample_rate": 1
      },
      "is_enabled": false,
      "name": "payment"
    }
  ],
  "filter": {
    "query": "source:python"
  },
  "is_rate_limited": false,
  "name": "main",
  "num_flex_logs_retention_days": 360,
  "num_retention_days": 15
}

Forbidden

Error response object.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Not Found

Response returned by the Logs API when errors occur.

Expand All

Campo

Tipo

Descripción

error

object

Error returned by the Logs API

code

string

Code identifying the error

details

[object]

Additional error details

message

string

Error message

{
  "error": {
    "code": "string",
    "details": [],
    "message": "string"
  }
}

Too many requests

Error response object.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Ejemplo de código

// Get an index returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.LogsIndexesApi;
import com.datadog.api.client.v1.model.LogsIndex;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    LogsIndexesApi apiInstance = new LogsIndexesApi(defaultClient);

    try {
      LogsIndex result = apiInstance.getLogsIndex("name");
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling LogsIndexesApi#getLogsIndex");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

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/v1/logs/config/indexeshttps://api.datadoghq.eu/api/v1/logs/config/indexeshttps://api.ddog-gov.com/api/v1/logs/config/indexeshttps://api.datadoghq.com/api/v1/logs/config/indexeshttps://api.us3.datadoghq.com/api/v1/logs/config/indexeshttps://api.us5.datadoghq.com/api/v1/logs/config/indexes

Información general

Crea un nuevo índice. Devuelve el objeto Índice enviado en el cuerpo de la solicitud cuando la solicitud se realiza correctamente. This endpoint requires the logs_modify_indexes permission.

Solicitud

Body Data (required)

Objeto que contiene el nuevo índice.

Expand All

Campo

Tipo

Descripción

daily_limit

int64

The number of log events you can send in this index per day before you are rate-limited.

daily_limit_reset

object

Object containing options to override the default daily limit reset time.

reset_time

string

String in HH:00 format representing the time of day the daily limit should be reset. The hours must be between 00 and 23 (inclusive).

reset_utc_offset

string

String in (-|+)HH:00 format representing the UTC offset to apply to the given reset time. The hours must be between -12 and +14 (inclusive).

daily_limit_warning_threshold_percentage

double

A percentage threshold of the daily quota at which a Datadog warning event is generated.

exclusion_filters

[object]

An array of exclusion objects. The logs are tested against the query of each filter, following the order of the array. Only the first matching active exclusion matters, others (if any) are ignored.

filter

object

Exclusion filter is defined by a query, a sampling rule, and a active/inactive toggle.

query

string

Default query is *, meaning all logs flowing in the index would be excluded. Scope down exclusion filter to only a subset of logs with a log query.

sample_rate [required]

double

Sample rate to apply to logs going through this exclusion filter, a value of 1.0 excludes all logs matching the query.

is_enabled

boolean

Whether or not the exclusion filter is active.

name [required]

string

Name of the index exclusion filter.

filter [required]

object

Filter for logs.

query

string

The filter query.

is_rate_limited

boolean

A boolean stating if the index is rate limited, meaning more logs than the daily limit have been sent. Rate limit is reset every-day at 2pm UTC.

name [required]

string

The name of the index.

num_flex_logs_retention_days

int64

The total number of days logs are stored in Standard and Flex Tier before being deleted from the index. If Standard Tier is enabled on this index, logs are first retained in Standard Tier for the number of days specified through num_retention_days, and then stored in Flex Tier until the number of days specified in num_flex_logs_retention_days is reached. The available values depend on retention plans specified in your organization's contract/subscriptions.

num_retention_days

int64

The number of days logs are stored in Standard Tier before aging into the Flex Tier or being deleted from the index. The available values depend on retention plans specified in your organization's contract/subscriptions.

{
  "daily_limit": 300000000,
  "daily_limit_reset": {
    "reset_time": "14:00",
    "reset_utc_offset": "+02:00"
  },
  "daily_limit_warning_threshold_percentage": 70,
  "exclusion_filters": [
    {
      "filter": {
        "query": "*",
        "sample_rate": 1
      },
      "is_enabled": false,
      "name": "payment"
    }
  ],
  "filter": {
    "query": "source:python"
  },
  "name": "main",
  "num_flex_logs_retention_days": 360,
  "num_retention_days": 15
}

Respuesta

OK

Object describing a Datadog Log index.

Expand All

Campo

Tipo

Descripción

daily_limit

int64

The number of log events you can send in this index per day before you are rate-limited.

daily_limit_reset

object

Object containing options to override the default daily limit reset time.

reset_time

string

String in HH:00 format representing the time of day the daily limit should be reset. The hours must be between 00 and 23 (inclusive).

reset_utc_offset

string

String in (-|+)HH:00 format representing the UTC offset to apply to the given reset time. The hours must be between -12 and +14 (inclusive).

daily_limit_warning_threshold_percentage

double

A percentage threshold of the daily quota at which a Datadog warning event is generated.

exclusion_filters

[object]

An array of exclusion objects. The logs are tested against the query of each filter, following the order of the array. Only the first matching active exclusion matters, others (if any) are ignored.

filter

object

Exclusion filter is defined by a query, a sampling rule, and a active/inactive toggle.

query

string

Default query is *, meaning all logs flowing in the index would be excluded. Scope down exclusion filter to only a subset of logs with a log query.

sample_rate [required]

double

Sample rate to apply to logs going through this exclusion filter, a value of 1.0 excludes all logs matching the query.

is_enabled

boolean

Whether or not the exclusion filter is active.

name [required]

string

Name of the index exclusion filter.

filter [required]

object

Filter for logs.

query

string

The filter query.

is_rate_limited

boolean

A boolean stating if the index is rate limited, meaning more logs than the daily limit have been sent. Rate limit is reset every-day at 2pm UTC.

name [required]

string

The name of the index.

num_flex_logs_retention_days

int64

The total number of days logs are stored in Standard and Flex Tier before being deleted from the index. If Standard Tier is enabled on this index, logs are first retained in Standard Tier for the number of days specified through num_retention_days, and then stored in Flex Tier until the number of days specified in num_flex_logs_retention_days is reached. The available values depend on retention plans specified in your organization's contract/subscriptions.

num_retention_days

int64

The number of days logs are stored in Standard Tier before aging into the Flex Tier or being deleted from the index. The available values depend on retention plans specified in your organization's contract/subscriptions.

{
  "daily_limit": 300000000,
  "daily_limit_reset": {
    "reset_time": "14:00",
    "reset_utc_offset": "+02:00"
  },
  "daily_limit_warning_threshold_percentage": 70,
  "exclusion_filters": [
    {
      "filter": {
        "query": "*",
        "sample_rate": 1
      },
      "is_enabled": false,
      "name": "payment"
    }
  ],
  "filter": {
    "query": "source:python"
  },
  "is_rate_limited": false,
  "name": "main",
  "num_flex_logs_retention_days": 360,
  "num_retention_days": 15
}

Invalid Parameter Error

Response returned by the Logs API when errors occur.

Expand All

Campo

Tipo

Descripción

error

object

Error returned by the Logs API

code

string

Code identifying the error

details

[object]

Additional error details

message

string

Error message

{
  "error": {
    "code": "string",
    "details": [],
    "message": "string"
  }
}

Forbidden

Error response object.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Too many requests

Error response object.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Ejemplo de código

// Create an index returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.LogsIndexesApi;
import com.datadog.api.client.v1.model.LogsDailyLimitReset;
import com.datadog.api.client.v1.model.LogsExclusion;
import com.datadog.api.client.v1.model.LogsExclusionFilter;
import com.datadog.api.client.v1.model.LogsFilter;
import com.datadog.api.client.v1.model.LogsIndex;
import java.util.Collections;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    LogsIndexesApi apiInstance = new LogsIndexesApi(defaultClient);

    LogsIndex body =
        new LogsIndex()
            .dailyLimit(300000000L)
            .dailyLimitReset(new LogsDailyLimitReset().resetTime("14:00").resetUtcOffset("+02:00"))
            .dailyLimitWarningThresholdPercentage(70.0)
            .exclusionFilters(
                Collections.singletonList(
                    new LogsExclusion()
                        .filter(new LogsExclusionFilter().query("*").sampleRate(1.0))
                        .name("payment")))
            .filter(new LogsFilter().query("source:python"))
            .name("main")
            .numFlexLogsRetentionDays(360L)
            .numRetentionDays(15L);

    try {
      LogsIndex result = apiInstance.createLogsIndex(body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling LogsIndexesApi#createLogsIndex");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

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"

PUT https://api.ap1.datadoghq.com/api/v1/logs/config/indexes/{name}https://api.datadoghq.eu/api/v1/logs/config/indexes/{name}https://api.ddog-gov.com/api/v1/logs/config/indexes/{name}https://api.datadoghq.com/api/v1/logs/config/indexes/{name}https://api.us3.datadoghq.com/api/v1/logs/config/indexes/{name}https://api.us5.datadoghq.com/api/v1/logs/config/indexes/{name}

Información general

Actualiza un índice identificado por su nombre. Devuelve el objeto Index enviado en el cuerpo de la solicitud, cuando la solicitud se realiza correctamente.

Utilizando el método PUT se actualiza la configuración del índice reemplazando tu configuración actual por la nueva, enviada a tu organización Datadog.

Argumentos

Parámetros de ruta

Nombre

Tipo

Descripción

name [required]

string

Name of the log index.

Solicitud

Body Data (required)

Objeto que contiene la nueva LogsIndexUpdateRequest.

Expand All

Campo

Tipo

Descripción

daily_limit

int64

The number of log events you can send in this index per day before you are rate-limited.

daily_limit_reset

object

Object containing options to override the default daily limit reset time.

reset_time

string

String in HH:00 format representing the time of day the daily limit should be reset. The hours must be between 00 and 23 (inclusive).

reset_utc_offset

string

String in (-|+)HH:00 format representing the UTC offset to apply to the given reset time. The hours must be between -12 and +14 (inclusive).

daily_limit_warning_threshold_percentage

double

A percentage threshold of the daily quota at which a Datadog warning event is generated.

disable_daily_limit

boolean

If true, sets the daily_limit value to null and the index is not limited on a daily basis (any specified daily_limit value in the request is ignored). If false or omitted, the index's current daily_limit is maintained.

exclusion_filters

[object]

An array of exclusion objects. The logs are tested against the query of each filter, following the order of the array. Only the first matching active exclusion matters, others (if any) are ignored.

filter

object

Exclusion filter is defined by a query, a sampling rule, and a active/inactive toggle.

query

string

Default query is *, meaning all logs flowing in the index would be excluded. Scope down exclusion filter to only a subset of logs with a log query.

sample_rate [required]

double

Sample rate to apply to logs going through this exclusion filter, a value of 1.0 excludes all logs matching the query.

is_enabled

boolean

Whether or not the exclusion filter is active.

name [required]

string

Name of the index exclusion filter.

filter [required]

object

Filter for logs.

query

string

The filter query.

num_flex_logs_retention_days

int64

The total number of days logs are stored in Standard and Flex Tier before being deleted from the index. If Standard Tier is enabled on this index, logs are first retained in Standard Tier for the number of days specified through num_retention_days, and then stored in Flex Tier until the number of days specified in num_flex_logs_retention_days is reached. The available values depend on retention plans specified in your organization's contract/subscriptions.

Note: Changing this value affects all logs already in this index. It may also affect billing.

num_retention_days

int64

The number of days logs are stored in Standard Tier before aging into the Flex Tier or being deleted from the index. The available values depend on retention plans specified in your organization's contract/subscriptions.

Note: Changing this value affects all logs already in this index. It may also affect billing.

{
  "daily_limit": 300000000,
  "daily_limit_reset": {
    "reset_time": "14:00",
    "reset_utc_offset": "+02:00"
  },
  "daily_limit_warning_threshold_percentage": 70,
  "disable_daily_limit": false,
  "exclusion_filters": [
    {
      "filter": {
        "query": "*",
        "sample_rate": 1
      },
      "is_enabled": false,
      "name": "payment"
    }
  ],
  "filter": {
    "query": "source:python"
  },
  "num_flex_logs_retention_days": 360,
  "num_retention_days": 15
}

Respuesta

OK

Object describing a Datadog Log index.

Expand All

Campo

Tipo

Descripción

daily_limit

int64

The number of log events you can send in this index per day before you are rate-limited.

daily_limit_reset

object

Object containing options to override the default daily limit reset time.

reset_time

string

String in HH:00 format representing the time of day the daily limit should be reset. The hours must be between 00 and 23 (inclusive).

reset_utc_offset

string

String in (-|+)HH:00 format representing the UTC offset to apply to the given reset time. The hours must be between -12 and +14 (inclusive).

daily_limit_warning_threshold_percentage

double

A percentage threshold of the daily quota at which a Datadog warning event is generated.

exclusion_filters

[object]

An array of exclusion objects. The logs are tested against the query of each filter, following the order of the array. Only the first matching active exclusion matters, others (if any) are ignored.

filter

object

Exclusion filter is defined by a query, a sampling rule, and a active/inactive toggle.

query

string

Default query is *, meaning all logs flowing in the index would be excluded. Scope down exclusion filter to only a subset of logs with a log query.

sample_rate [required]

double

Sample rate to apply to logs going through this exclusion filter, a value of 1.0 excludes all logs matching the query.

is_enabled

boolean

Whether or not the exclusion filter is active.

name [required]

string

Name of the index exclusion filter.

filter [required]

object

Filter for logs.

query

string

The filter query.

is_rate_limited

boolean

A boolean stating if the index is rate limited, meaning more logs than the daily limit have been sent. Rate limit is reset every-day at 2pm UTC.

name [required]

string

The name of the index.

num_flex_logs_retention_days

int64

The total number of days logs are stored in Standard and Flex Tier before being deleted from the index. If Standard Tier is enabled on this index, logs are first retained in Standard Tier for the number of days specified through num_retention_days, and then stored in Flex Tier until the number of days specified in num_flex_logs_retention_days is reached. The available values depend on retention plans specified in your organization's contract/subscriptions.

num_retention_days

int64

The number of days logs are stored in Standard Tier before aging into the Flex Tier or being deleted from the index. The available values depend on retention plans specified in your organization's contract/subscriptions.

{
  "daily_limit": 300000000,
  "daily_limit_reset": {
    "reset_time": "14:00",
    "reset_utc_offset": "+02:00"
  },
  "daily_limit_warning_threshold_percentage": 70,
  "exclusion_filters": [
    {
      "filter": {
        "query": "*",
        "sample_rate": 1
      },
      "is_enabled": false,
      "name": "payment"
    }
  ],
  "filter": {
    "query": "source:python"
  },
  "is_rate_limited": false,
  "name": "main",
  "num_flex_logs_retention_days": 360,
  "num_retention_days": 15
}

Invalid Parameter Error

Response returned by the Logs API when errors occur.

Expand All

Campo

Tipo

Descripción

error

object

Error returned by the Logs API

code

string

Code identifying the error

details

[object]

Additional error details

message

string

Error message

{
  "error": {
    "code": "string",
    "details": [],
    "message": "string"
  }
}

Forbidden

Error response object.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Too Many Requests

Response returned by the Logs API when errors occur.

Expand All

Campo

Tipo

Descripción

error

object

Error returned by the Logs API

code

string

Code identifying the error

details

[object]

Additional error details

message

string

Error message

{
  "error": {
    "code": "string",
    "details": [],
    "message": "string"
  }
}

Ejemplo de código

// Update an index returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.LogsIndexesApi;
import com.datadog.api.client.v1.model.LogsDailyLimitReset;
import com.datadog.api.client.v1.model.LogsExclusion;
import com.datadog.api.client.v1.model.LogsExclusionFilter;
import com.datadog.api.client.v1.model.LogsFilter;
import com.datadog.api.client.v1.model.LogsIndex;
import com.datadog.api.client.v1.model.LogsIndexUpdateRequest;
import java.util.Collections;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    LogsIndexesApi apiInstance = new LogsIndexesApi(defaultClient);

    LogsIndexUpdateRequest body =
        new LogsIndexUpdateRequest()
            .dailyLimit(300000000L)
            .dailyLimitReset(new LogsDailyLimitReset().resetTime("14:00").resetUtcOffset("+02:00"))
            .dailyLimitWarningThresholdPercentage(70.0)
            .disableDailyLimit(false)
            .exclusionFilters(
                Collections.singletonList(
                    new LogsExclusion()
                        .filter(new LogsExclusionFilter().query("*").sampleRate(1.0))
                        .name("payment")))
            .filter(new LogsFilter().query("source:python"))
            .numFlexLogsRetentionDays(360L)
            .numRetentionDays(15L);

    try {
      LogsIndex result = apiInstance.updateLogsIndex("name", body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling LogsIndexesApi#updateLogsIndex");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

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/v1/logs/config/indexes/{name}https://api.datadoghq.eu/api/v1/logs/config/indexes/{name}https://api.ddog-gov.com/api/v1/logs/config/indexes/{name}https://api.datadoghq.com/api/v1/logs/config/indexes/{name}https://api.us3.datadoghq.com/api/v1/logs/config/indexes/{name}https://api.us5.datadoghq.com/api/v1/logs/config/indexes/{name}

Información general

Delete an existing index from your organization. Index deletions are permanent and cannot be reverted. You cannot recreate an index with the same name as deleted ones. This endpoint requires the logs_modify_indexes permission.

Argumentos

Parámetros de ruta

Nombre

Tipo

Descripción

name [required]

string

Name of the log index.

Respuesta

OK

Forbidden

Error response object.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Not Found

Response returned by the Logs API when errors occur.

Expand All

Campo

Tipo

Descripción

error

object

Error returned by the Logs API

code

string

Code identifying the error

details

[object]

Additional error details

message

string

Error message

{
  "error": {
    "code": "string",
    "details": [],
    "message": "string"
  }
}

Too many requests

Error response object.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Ejemplo de código

// Delete an index returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.LogsIndexesApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    LogsIndexesApi apiInstance = new LogsIndexesApi(defaultClient);

    try {
      apiInstance.deleteLogsIndex("name");
    } catch (ApiException e) {
      System.err.println("Exception when calling LogsIndexesApi#deleteLogsIndex");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

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/v1/logs/config/index-orderhttps://api.datadoghq.eu/api/v1/logs/config/index-orderhttps://api.ddog-gov.com/api/v1/logs/config/index-orderhttps://api.datadoghq.com/api/v1/logs/config/index-orderhttps://api.us3.datadoghq.com/api/v1/logs/config/index-orderhttps://api.us5.datadoghq.com/api/v1/logs/config/index-order

Información general

Obtén el orden actual de tus índices de logs. Este endpoint no recibe argumentos JSON. This endpoint requires the logs_read_config permission.

Respuesta

OK

Object containing the ordered list of log index names.

Expand All

Campo

Tipo

Descripción

index_names [required]

[string]

Array of strings identifying by their name(s) the index(es) of your organization. Logs are tested against the query filter of each index one by one, following the order of the array. Logs are eventually stored in the first matching index.

{
  "index_names": [
    "main",
    "payments",
    "web"
  ]
}

Forbidden

Error response object.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Too many requests

Error response object.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Ejemplo de código

// Get indexes order returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.LogsIndexesApi;
import com.datadog.api.client.v1.model.LogsIndexesOrder;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    LogsIndexesApi apiInstance = new LogsIndexesApi(defaultClient);

    try {
      LogsIndexesOrder result = apiInstance.getLogsIndexOrder();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling LogsIndexesApi#getLogsIndexOrder");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

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"

PUT https://api.ap1.datadoghq.com/api/v1/logs/config/index-orderhttps://api.datadoghq.eu/api/v1/logs/config/index-orderhttps://api.ddog-gov.com/api/v1/logs/config/index-orderhttps://api.datadoghq.com/api/v1/logs/config/index-orderhttps://api.us3.datadoghq.com/api/v1/logs/config/index-orderhttps://api.us5.datadoghq.com/api/v1/logs/config/index-order

Información general

Este endpoint actualiza el orden de los índices de tu organización. Devuelve el objeto de orden de índice enviado en el cuerpo de la solicitud, cuando la solicitud se realiza correctamente. This endpoint requires the logs_modify_indexes permission.

Solicitud

Body Data (required)

Objeto que contiene la nueva lista ordenada de nombres de índices

Expand All

Campo

Tipo

Descripción

index_names [required]

[string]

Array of strings identifying by their name(s) the index(es) of your organization. Logs are tested against the query filter of each index one by one, following the order of the array. Logs are eventually stored in the first matching index.

{
  "index_names": [
    "main",
    "payments",
    "web"
  ]
}

Respuesta

OK

Object containing the ordered list of log index names.

Expand All

Campo

Tipo

Descripción

index_names [required]

[string]

Array of strings identifying by their name(s) the index(es) of your organization. Logs are tested against the query filter of each index one by one, following the order of the array. Logs are eventually stored in the first matching index.

{
  "index_names": [
    "main",
    "payments",
    "web"
  ]
}

Bad Request

Response returned by the Logs API when errors occur.

Expand All

Campo

Tipo

Descripción

error

object

Error returned by the Logs API

code

string

Code identifying the error

details

[object]

Additional error details

message

string

Error message

{
  "error": {
    "code": "string",
    "details": [],
    "message": "string"
  }
}

Forbidden

Error response object.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Too many requests

Error response object.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Ejemplo de código

// Update indexes order returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.LogsIndexesApi;
import com.datadog.api.client.v1.model.LogsIndexesOrder;
import java.util.Arrays;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    LogsIndexesApi apiInstance = new LogsIndexesApi(defaultClient);

    LogsIndexesOrder body =
        new LogsIndexesOrder().indexNames(Arrays.asList("main", "payments", "web"));

    try {
      LogsIndexesOrder result = apiInstance.updateLogsIndexOrder(body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling LogsIndexesApi#updateLogsIndexOrder");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

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"