For AI agents: A markdown version of this page is available at https://dnd37xeb23o8n.cloudfront.net/stefon.simmons/docs-astro-web-10435/ko/api/latest/metrics/create-a-tag-indexing-rule.md. A documentation index is available at /llms.txt.
Language
Datadog site

태그 인덱싱 규칙 생성

경고Note: The Tag Indexing Rules feature is currently in Preview. If you have any feedback, contact Datadog support.
POSThttps://api.datadoghq.com/api/v2/metrics/tag-indexing-ruleshttps://api.us3.datadoghq.com/api/v2/metrics/tag-indexing-ruleshttps://api.us5.datadoghq.com/api/v2/metrics/tag-indexing-ruleshttps://api.datadoghq.eu/api/v2/metrics/tag-indexing-ruleshttps://api.ap1.datadoghq.com/api/v2/metrics/tag-indexing-ruleshttps://api.ap2.datadoghq.com/api/v2/metrics/tag-indexing-ruleshttps://api.uk1.datadoghq.com/api/v2/metrics/tag-indexing-ruleshttps://api.ddog-gov.com/api/v2/metrics/tag-indexing-ruleshttps://api.us2.ddog-gov.com/api/v2/metrics/tag-indexing-rules

개요

조직에 대한 태그 인덱싱 규칙을 생성합니다. rule_order는 서버 측에서 기존 규칙 중에서 max+1로 할당됩니다. 평가 순서를 변경하려면 재정렬 엔드포인트를 사용하세요. Manage Tags for Metrics 권한이 필요합니다.

This endpoint requires the metric_tags_write permission.

OAuth apps require the metric_tags_write authorization scope to access this endpoint.

요청

Body Data (required)

항목
유형
설명
data [required]
object

태그 인덱싱 규칙 생성을 위한 요청 본문입니다.

응답

Created

Response containing a single tag indexing rule.

항목
유형
설명
data
object

A tag indexing rule resource object.

코드 예시

Create a tag indexing rule returns "Created" response
# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/metrics/tag-indexing-rules" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "exclude_tags_mode": false,
      "ignored_metric_name_matches": [],
      "metric_name_matches": [
        "dd.test.*"
      ],
      "name": "my-indexing-rule",
      "options": {
        "data": {
          "dynamic_tags": {},
          "manage_preexisting_metrics": true,
          "metric_match": {
            "queried_window_seconds": 3600
          },
          "override_previous_rules": false
        },
        "version": 1
      },
      "tags": [
        "env",
        "service"
      ]
    },
    "type": "tag_indexing_rules"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/metrics/tag-indexing-rules" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "exclude_tags_mode": false,
      "ignored_metric_name_matches": [],
      "metric_name_matches": [
        "dd.test.*"
      ],
      "name": "my-indexing-rule",
      "options": {
        "data": {
          "dynamic_tags": {},
          "manage_preexisting_metrics": true,
          "metric_match": {
            "queried_window_seconds": 3600
          },
          "override_previous_rules": false
        },
        "version": 1
      },
      "tags": [
        "env",
        "service"
      ]
    },
    "type": "tag_indexing_rules"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/metrics/tag-indexing-rules" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "exclude_tags_mode": false,
      "ignored_metric_name_matches": [],
      "metric_name_matches": [
        "dd.test.*"
      ],
      "name": "my-indexing-rule",
      "options": {
        "data": {
          "dynamic_tags": {},
          "manage_preexisting_metrics": true,
          "metric_match": {
            "queried_window_seconds": 3600
          },
          "override_previous_rules": false
        },
        "version": 1
      },
      "tags": [
        "env",
        "service"
      ]
    },
    "type": "tag_indexing_rules"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/metrics/tag-indexing-rules" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "exclude_tags_mode": false,
      "ignored_metric_name_matches": [],
      "metric_name_matches": [
        "dd.test.*"
      ],
      "name": "my-indexing-rule",
      "options": {
        "data": {
          "dynamic_tags": {},
          "manage_preexisting_metrics": true,
          "metric_match": {
            "queried_window_seconds": 3600
          },
          "override_previous_rules": false
        },
        "version": 1
      },
      "tags": [
        "env",
        "service"
      ]
    },
    "type": "tag_indexing_rules"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/metrics/tag-indexing-rules" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "exclude_tags_mode": false,
      "ignored_metric_name_matches": [],
      "metric_name_matches": [
        "dd.test.*"
      ],
      "name": "my-indexing-rule",
      "options": {
        "data": {
          "dynamic_tags": {},
          "manage_preexisting_metrics": true,
          "metric_match": {
            "queried_window_seconds": 3600
          },
          "override_previous_rules": false
        },
        "version": 1
      },
      "tags": [
        "env",
        "service"
      ]
    },
    "type": "tag_indexing_rules"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/metrics/tag-indexing-rules" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "exclude_tags_mode": false,
      "ignored_metric_name_matches": [],
      "metric_name_matches": [
        "dd.test.*"
      ],
      "name": "my-indexing-rule",
      "options": {
        "data": {
          "dynamic_tags": {},
          "manage_preexisting_metrics": true,
          "metric_match": {
            "queried_window_seconds": 3600
          },
          "override_previous_rules": false
        },
        "version": 1
      },
      "tags": [
        "env",
        "service"
      ]
    },
    "type": "tag_indexing_rules"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/metrics/tag-indexing-rules" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "exclude_tags_mode": false,
      "ignored_metric_name_matches": [],
      "metric_name_matches": [
        "dd.test.*"
      ],
      "name": "my-indexing-rule",
      "options": {
        "data": {
          "dynamic_tags": {},
          "manage_preexisting_metrics": true,
          "metric_match": {
            "queried_window_seconds": 3600
          },
          "override_previous_rules": false
        },
        "version": 1
      },
      "tags": [
        "env",
        "service"
      ]
    },
    "type": "tag_indexing_rules"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="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 POST "https://api.${DD_SITE}/api/v2/metrics/tag-indexing-rules" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "exclude_tags_mode": false,
      "ignored_metric_name_matches": [],
      "metric_name_matches": [
        "dd.test.*"
      ],
      "name": "my-indexing-rule",
      "options": {
        "data": {
          "dynamic_tags": {},
          "manage_preexisting_metrics": true,
          "metric_match": {
            "queried_window_seconds": 3600
          },
          "override_previous_rules": false
        },
        "version": 1
      },
      "tags": [
        "env",
        "service"
      ]
    },
    "type": "tag_indexing_rules"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="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 POST "https://api.${DD_SITE}/api/v2/metrics/tag-indexing-rules" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "exclude_tags_mode": false,
      "ignored_metric_name_matches": [],
      "metric_name_matches": [
        "dd.test.*"
      ],
      "name": "my-indexing-rule",
      "options": {
        "data": {
          "dynamic_tags": {},
          "manage_preexisting_metrics": true,
          "metric_match": {
            "queried_window_seconds": 3600
          },
          "override_previous_rules": false
        },
        "version": 1
      },
      "tags": [
        "env",
        "service"
      ]
    },
    "type": "tag_indexing_rules"
  }
}
EOF
Create a tag indexing rule with exclude-mode tag usage fields returns "Created" response
# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/metrics/tag-indexing-rules" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "exclude_tags_mode": true,
      "ignored_metric_name_matches": [],
      "metric_name_matches": [
        "dd.test.*"
      ],
      "name": "my-indexing-rule",
      "options": {
        "data": {
          "dynamic_tags": {
            "exclude_not_queried_window_seconds": 3600,
            "exclude_not_used_in_assets": true
          },
          "manage_preexisting_metrics": true,
          "override_previous_rules": false
        },
        "version": 1
      },
      "tags": [
        "env",
        "service"
      ]
    },
    "type": "tag_indexing_rules"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/metrics/tag-indexing-rules" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "exclude_tags_mode": true,
      "ignored_metric_name_matches": [],
      "metric_name_matches": [
        "dd.test.*"
      ],
      "name": "my-indexing-rule",
      "options": {
        "data": {
          "dynamic_tags": {
            "exclude_not_queried_window_seconds": 3600,
            "exclude_not_used_in_assets": true
          },
          "manage_preexisting_metrics": true,
          "override_previous_rules": false
        },
        "version": 1
      },
      "tags": [
        "env",
        "service"
      ]
    },
    "type": "tag_indexing_rules"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/metrics/tag-indexing-rules" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "exclude_tags_mode": true,
      "ignored_metric_name_matches": [],
      "metric_name_matches": [
        "dd.test.*"
      ],
      "name": "my-indexing-rule",
      "options": {
        "data": {
          "dynamic_tags": {
            "exclude_not_queried_window_seconds": 3600,
            "exclude_not_used_in_assets": true
          },
          "manage_preexisting_metrics": true,
          "override_previous_rules": false
        },
        "version": 1
      },
      "tags": [
        "env",
        "service"
      ]
    },
    "type": "tag_indexing_rules"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/metrics/tag-indexing-rules" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "exclude_tags_mode": true,
      "ignored_metric_name_matches": [],
      "metric_name_matches": [
        "dd.test.*"
      ],
      "name": "my-indexing-rule",
      "options": {
        "data": {
          "dynamic_tags": {
            "exclude_not_queried_window_seconds": 3600,
            "exclude_not_used_in_assets": true
          },
          "manage_preexisting_metrics": true,
          "override_previous_rules": false
        },
        "version": 1
      },
      "tags": [
        "env",
        "service"
      ]
    },
    "type": "tag_indexing_rules"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/metrics/tag-indexing-rules" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "exclude_tags_mode": true,
      "ignored_metric_name_matches": [],
      "metric_name_matches": [
        "dd.test.*"
      ],
      "name": "my-indexing-rule",
      "options": {
        "data": {
          "dynamic_tags": {
            "exclude_not_queried_window_seconds": 3600,
            "exclude_not_used_in_assets": true
          },
          "manage_preexisting_metrics": true,
          "override_previous_rules": false
        },
        "version": 1
      },
      "tags": [
        "env",
        "service"
      ]
    },
    "type": "tag_indexing_rules"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/metrics/tag-indexing-rules" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "exclude_tags_mode": true,
      "ignored_metric_name_matches": [],
      "metric_name_matches": [
        "dd.test.*"
      ],
      "name": "my-indexing-rule",
      "options": {
        "data": {
          "dynamic_tags": {
            "exclude_not_queried_window_seconds": 3600,
            "exclude_not_used_in_assets": true
          },
          "manage_preexisting_metrics": true,
          "override_previous_rules": false
        },
        "version": 1
      },
      "tags": [
        "env",
        "service"
      ]
    },
    "type": "tag_indexing_rules"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/metrics/tag-indexing-rules" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "exclude_tags_mode": true,
      "ignored_metric_name_matches": [],
      "metric_name_matches": [
        "dd.test.*"
      ],
      "name": "my-indexing-rule",
      "options": {
        "data": {
          "dynamic_tags": {
            "exclude_not_queried_window_seconds": 3600,
            "exclude_not_used_in_assets": true
          },
          "manage_preexisting_metrics": true,
          "override_previous_rules": false
        },
        "version": 1
      },
      "tags": [
        "env",
        "service"
      ]
    },
    "type": "tag_indexing_rules"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="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 POST "https://api.${DD_SITE}/api/v2/metrics/tag-indexing-rules" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "exclude_tags_mode": true,
      "ignored_metric_name_matches": [],
      "metric_name_matches": [
        "dd.test.*"
      ],
      "name": "my-indexing-rule",
      "options": {
        "data": {
          "dynamic_tags": {
            "exclude_not_queried_window_seconds": 3600,
            "exclude_not_used_in_assets": true
          },
          "manage_preexisting_metrics": true,
          "override_previous_rules": false
        },
        "version": 1
      },
      "tags": [
        "env",
        "service"
      ]
    },
    "type": "tag_indexing_rules"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="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 POST "https://api.${DD_SITE}/api/v2/metrics/tag-indexing-rules" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "exclude_tags_mode": true,
      "ignored_metric_name_matches": [],
      "metric_name_matches": [
        "dd.test.*"
      ],
      "name": "my-indexing-rule",
      "options": {
        "data": {
          "dynamic_tags": {
            "exclude_not_queried_window_seconds": 3600,
            "exclude_not_used_in_assets": true
          },
          "manage_preexisting_metrics": true,
          "override_previous_rules": false
        },
        "version": 1
      },
      "tags": [
        "env",
        "service"
      ]
    },
    "type": "tag_indexing_rules"
  }
}
EOF