---
title: 인덱스 가져오기
description: 소속 조직에서 로그 인덱스 하나를 가져옵니다. 이 엔드포인트는 JSON 인수를 사용하지 않습니다.
breadcrumbs: 문서 > API > 인덱스 가져오기
---

> For the complete documentation index, see [llms.txt](https://dnd37xeb23o8n.cloudfront.net/stefon.simmons/docs-astro-web-10435/llms.txt).

# 인덱스 가져오기

## v1 (latest)

| Datadog site      | API endpoint                                                        |
| ----------------- | ------------------------------------------------------------------- |
| app.datadoghq.com | GET https://api.datadoghq.com/api/v1/logs/config/indexes/{name}     |
| us3.datadoghq.com | GET https://api.us3.datadoghq.com/api/v1/logs/config/indexes/{name} |
| us5.datadoghq.com | GET https://api.us5.datadoghq.com/api/v1/logs/config/indexes/{name} |
| app.datadoghq.eu  | GET https://api.datadoghq.eu/api/v1/logs/config/indexes/{name}      |
| ap1.datadoghq.com | GET https://api.ap1.datadoghq.com/api/v1/logs/config/indexes/{name} |
| ap2.datadoghq.com | GET https://api.ap2.datadoghq.com/api/v1/logs/config/indexes/{name} |
| uk1.datadoghq.com | GET https://api.uk1.datadoghq.com/api/v1/logs/config/indexes/{name} |
| app.ddog-gov.com  | GET https://api.ddog-gov.com/api/v1/logs/config/indexes/{name}      |
| us2.ddog-gov.com  | GET https://api.us2.ddog-gov.com/api/v1/logs/config/indexes/{name}  |

### Overview

소속 조직에서 로그 인덱스 하나를 가져옵니다. 이 엔드포인트는 JSON 인수를 사용하지 않습니다.

This endpoint requires the `logs_read_config` permission.

### Arguments

#### Path Parameters

| Field             | Type   | Description            |
| ----------------- | ------ | ---------------------- |
| name [*required*] | string | Name of the log index. |

### Response

{% tabs %}
{% tab label="200" %}
OK

{% tabs %}
{% tab label="Model" %}
Object describing a Datadog Log index.

| Parent field      | Field                                    | Type     | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| ----------------- | ---------------------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|                   | 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.                                                                                                                                                                                                                                                                                                                                                                                                        |
| daily_limit_reset | 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).                                                                                                                                                                                                                                                                                                                                          |
| daily_limit_reset | 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.                                                                                                                                                                                                                                                                            |
| exclusion_filters | filter                                   | object   | Exclusion filter is defined by a query, a sampling rule, and a active/inactive toggle.                                                                                                                                                                                                                                                                                                                                                                                           |
| filter            | 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.                                                                                                                                                                                                                                                                                                                            |
| filter            | sample_attribute                         | string   | Sample attribute to use for the sampling of logs going through this exclusion filter. When set, only the logs with the specified attribute are sampled.                                                                                                                                                                                                                                                                                                                          |
| filter            | 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.                                                                                                                                                                                                                                                                                                                                                           |
| exclusion_filters | is_enabled                               | boolean  | Whether or not the exclusion filter is active.                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| exclusion_filters | name [*required*]                        | string   | Name of the index exclusion filter.                                                                                                                                                                                                                                                                                                                                                                                                                                              |
|                   | filter [*required*]                      | object   | Filter for logs.                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| filter            | 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. Read-only.                                                                                                                                                                                                                                                                                                                      |
|                   | 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.                                                                                                                                                                                                                                                     |
|                   | tags                                     | [string] | A list of tags associated with the index. Tags must be in `key:value` format.                                                                                                                                                                                                                                                                                                                                                                                                    |
{% /tab %}

{% tab label="Example" %}
```json
{
  "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_attribute": "@ci.job_id",
        "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,
  "tags": [
    "team:backend",
    "env:production"
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="403" %}
Forbidden

{% tabs %}
{% tab label="Model" %}
Error response object.

| Field               | Type     | Description                          |
| ------------------- | -------- | ------------------------------------ |
| errors [*required*] | [string] | Array of errors returned by the API. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    "Bad Request"
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="404" %}
Not Found

{% tabs %}
{% tab label="Model" %}
Response returned by the Logs API when errors occur.

| Parent field | Field   | Type     | Description                    |
| ------------ | ------- | -------- | ------------------------------ |
|              | error   | object   | Error returned by the Logs API |
| error        | code    | string   | Code identifying the error     |
| error        | details | [object] | Additional error details       |
| error        | message | string   | Error message                  |
{% /tab %}

{% tab label="Example" %}
```json
{
  "error": {
    "code": "string",
    "details": [],
    "message": "string"
  }
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="429" %}
Too many requests

{% tabs %}
{% tab label="Model" %}
Error response object.

| Field               | Type     | Description                          |
| ------------------- | -------- | ------------------------------------ |
| errors [*required*] | [string] | Array of errors returned by the API. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    "Bad Request"
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}
{% /tabs %}

### Code Example

{% tabs %}
{% tab label="Curl" %}
```bash
# Path parameters
export name="CHANGE_ME"

# Set your Datadog site and credentials
export DD_SITE="datadoghq.com" # Or us3.datadoghq.com, us5.datadoghq.com, datadoghq.eu, ap1.datadoghq.com, ap2.datadoghq.com, uk1.datadoghq.com, ddog-gov.com, us2.ddog-gov.com
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X GET "https://api.${DD_SITE}/api/v1/logs/config/indexes/${name}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
```
{% /tab %}

{% tab label="Go" %}
```go
// Get an index returns "OK" response

package main

import (
	"context"
	"encoding/json"
	"fmt"
	"os"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV1"
)

func main() {
	ctx := datadog.NewDefaultContext(context.Background())
	ctx = context.WithValue(ctx, datadog.ContextAccessToken, os.Getenv("DD_BEARER_TOKEN"))
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV1.NewLogsIndexesApi(apiClient)
	resp, r, err := api.GetLogsIndex(ctx, "name")

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `LogsIndexesApi.GetLogsIndex`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `LogsIndexesApi.GetLogsIndex`:\n%s\n", responseContent)
}
```

#### Instructions

First [install the library and its dependencies](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=go) and then save the example to `main.go` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"
```
{% /tab %}

{% tab label="Java" %}
```java
// 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();
    defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
    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](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=java) and then save the example to `Example.java` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"
```
{% /tab %}

{% tab label="Python" %}
```python
"""
Get an index returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.logs_indexes_api import LogsIndexesApi

configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
with ApiClient(configuration) as api_client:
    api_instance = LogsIndexesApi(api_client)
    response = api_instance.get_logs_index(
        name="name",
    )

    print(response)
```

#### Instructions

First [install the library and its dependencies](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=python) and then save the example to `example.py` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"
```
{% /tab %}

{% tab label="Ruby" %}
```ruby
# Get an index returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
  config.access_token = ENV["DD_BEARER_TOKEN"]
end
api_instance = DatadogAPIClient::V1::LogsIndexesAPI.new
p api_instance.get_logs_index("name")
```

#### Instructions

First [install the library and its dependencies](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=ruby) and then save the example to `example.rb` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"
```
{% /tab %}

{% tab label="Rust" %}
```rust
// Get an index returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV1::api_logs_indexes::LogsIndexesAPI;

#[tokio::main]
async fn main() {
    let configuration = datadog::Configuration::new();
    let api = LogsIndexesAPI::with_config(configuration);
    let resp = api.get_logs_index("name".to_string()).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}
```

#### Instructions

First [install the library and its dependencies](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=rust) and then save the example to `src/main.rs` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo run
```
{% /tab %}

{% tab label="TypeScript" %}
```typescript
/**
 * Get an index returns "OK" response
 */

import { client, v1 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration({
  authMethods: {
    AuthZ: {
      accessToken: process.env.DD_BEARER_TOKEN as string,
    },
  },
});
const apiInstance = new v1.LogsIndexesApi(configuration);

const params: v1.LogsIndexesApiGetLogsIndexRequest = {
  name: "name",
};

apiInstance
  .getLogsIndex(params)
  .then((data: v1.LogsIndex) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));
```

#### Instructions

First [install the library and its dependencies](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=typescript) and then save the example to `example.ts` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"
```
{% /tab %}
{% /tabs %}
