---
title: ログ制限クエリ
description: "注: このエンドポイントは公開ベータ版です。ご意見がありましたら、Datadog サポート にお寄せください。"
breadcrumbs: ドキュメント > API > ログ制限クエリ
---

> For the complete documentation index, see [llms.txt](https://dnd37xeb23o8n.cloudfront.net/jen.gilbert/astro-base/llms.txt).

# ログ制限クエリ

**注: このエンドポイントは公開ベータ版です。ご意見がありましたら、[Datadog サポート](https://docs.datadoghq.com/help.md) にお寄せください。**

制限クエリとは、「logs_read_data」権限によって読み取りアクセスが許可されるログを制限するログクエリのことです。
ロールに制限クエリがあるユーザーの場合、任意のログクエリを実行すると、制限クエリのいずれかに一致する
ログイベントのみが返されます。これは、ユーザーがログエクスプローラー、Live Tail、再ハイドレーション、またはダッシュボードウィジェットを含む、
任意のログ関連機能からログイベントをクエリする場合にも当てはまります。

制限クエリは現在、ログイベントの以下のコンポーネントのみの使用をサポートしています。

- 予約済み属性
- ログメッセージ
- タグ

ログデータへの読み取りアクセスを制限するには、ログイベントにチームタグを追加して所有チームを示し、その後、制限クエリのスコープを該当するチームタグの値に設定します。タグはさまざまな方法でログイベントに適用でき、ログイベントには同じキー (team など) で値が異なる複数のタグを設定できます。つまり、制限クエリのスコープが異なる team の値に設定されているロールでも、同じログイベントを閲覧できる場合があります。

制限クエリを追加する方法については、[ログ用に RBAC を設定する方法](https://docs.datadoghq.com/logs/guide/logs-rbac.md?tab=api#restrict-access-to-logs) を参照してください。

## [制限クエリを一覧表示する](https://dnd37xeb23o8n.cloudfront.net/jen.gilbert/astro-base/ja/api/latest/logs-restriction-queries/list-restriction-queries.md) (preview)

| Datadog site      | API endpoint                                                             |
| ----------------- | ------------------------------------------------------------------------ |
| app.datadoghq.com | GET https://api.datadoghq.com/api/v2/logs/config/restriction_queries     |
| us3.datadoghq.com | GET https://api.us3.datadoghq.com/api/v2/logs/config/restriction_queries |
| us5.datadoghq.com | GET https://api.us5.datadoghq.com/api/v2/logs/config/restriction_queries |
| app.datadoghq.eu  | GET https://api.datadoghq.eu/api/v2/logs/config/restriction_queries      |
| ap1.datadoghq.com | GET https://api.ap1.datadoghq.com/api/v2/logs/config/restriction_queries |
| ap2.datadoghq.com | GET https://api.ap2.datadoghq.com/api/v2/logs/config/restriction_queries |
| uk1.datadoghq.com | GET https://api.uk1.datadoghq.com/api/v2/logs/config/restriction_queries |
| app.ddog-gov.com  | GET https://api.ddog-gov.com/api/v2/logs/config/restriction_queries      |
| us2.ddog-gov.com  | GET https://api.us2.ddog-gov.com/api/v2/logs/config/restriction_queries  |

## [制限クエリを作成する](https://dnd37xeb23o8n.cloudfront.net/jen.gilbert/astro-base/ja/api/latest/logs-restriction-queries/create-a-restriction-query.md) (preview)

| Datadog site      | API endpoint                                                              |
| ----------------- | ------------------------------------------------------------------------- |
| app.datadoghq.com | POST https://api.datadoghq.com/api/v2/logs/config/restriction_queries     |
| us3.datadoghq.com | POST https://api.us3.datadoghq.com/api/v2/logs/config/restriction_queries |
| us5.datadoghq.com | POST https://api.us5.datadoghq.com/api/v2/logs/config/restriction_queries |
| app.datadoghq.eu  | POST https://api.datadoghq.eu/api/v2/logs/config/restriction_queries      |
| ap1.datadoghq.com | POST https://api.ap1.datadoghq.com/api/v2/logs/config/restriction_queries |
| ap2.datadoghq.com | POST https://api.ap2.datadoghq.com/api/v2/logs/config/restriction_queries |
| uk1.datadoghq.com | POST https://api.uk1.datadoghq.com/api/v2/logs/config/restriction_queries |
| app.ddog-gov.com  | POST https://api.ddog-gov.com/api/v2/logs/config/restriction_queries      |
| us2.ddog-gov.com  | POST https://api.us2.ddog-gov.com/api/v2/logs/config/restriction_queries  |

## [制限クエリを取得する](https://dnd37xeb23o8n.cloudfront.net/jen.gilbert/astro-base/ja/api/latest/logs-restriction-queries/get-a-restriction-query.md) (preview)

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

## [制限クエリを更新する](https://dnd37xeb23o8n.cloudfront.net/jen.gilbert/astro-base/ja/api/latest/logs-restriction-queries/update-a-restriction-query.md) (preview)

| Datadog site      | API endpoint                                                                                      |
| ----------------- | ------------------------------------------------------------------------------------------------- |
| app.datadoghq.com | PATCH https://api.datadoghq.com/api/v2/logs/config/restriction_queries/{restriction_query_id}     |
| us3.datadoghq.com | PATCH https://api.us3.datadoghq.com/api/v2/logs/config/restriction_queries/{restriction_query_id} |
| us5.datadoghq.com | PATCH https://api.us5.datadoghq.com/api/v2/logs/config/restriction_queries/{restriction_query_id} |
| app.datadoghq.eu  | PATCH https://api.datadoghq.eu/api/v2/logs/config/restriction_queries/{restriction_query_id}      |
| ap1.datadoghq.com | PATCH https://api.ap1.datadoghq.com/api/v2/logs/config/restriction_queries/{restriction_query_id} |
| ap2.datadoghq.com | PATCH https://api.ap2.datadoghq.com/api/v2/logs/config/restriction_queries/{restriction_query_id} |
| uk1.datadoghq.com | PATCH https://api.uk1.datadoghq.com/api/v2/logs/config/restriction_queries/{restriction_query_id} |
| app.ddog-gov.com  | PATCH https://api.ddog-gov.com/api/v2/logs/config/restriction_queries/{restriction_query_id}      |
| us2.ddog-gov.com  | PATCH https://api.us2.ddog-gov.com/api/v2/logs/config/restriction_queries/{restriction_query_id}  |

## [Replace a restriction query](https://dnd37xeb23o8n.cloudfront.net/jen.gilbert/astro-base/ja/api/latest/logs-restriction-queries/replace-a-restriction-query.md) (preview)

| Datadog site      | API endpoint                                                                                    |
| ----------------- | ----------------------------------------------------------------------------------------------- |
| app.datadoghq.com | PUT https://api.datadoghq.com/api/v2/logs/config/restriction_queries/{restriction_query_id}     |
| us3.datadoghq.com | PUT https://api.us3.datadoghq.com/api/v2/logs/config/restriction_queries/{restriction_query_id} |
| us5.datadoghq.com | PUT https://api.us5.datadoghq.com/api/v2/logs/config/restriction_queries/{restriction_query_id} |
| app.datadoghq.eu  | PUT https://api.datadoghq.eu/api/v2/logs/config/restriction_queries/{restriction_query_id}      |
| ap1.datadoghq.com | PUT https://api.ap1.datadoghq.com/api/v2/logs/config/restriction_queries/{restriction_query_id} |
| ap2.datadoghq.com | PUT https://api.ap2.datadoghq.com/api/v2/logs/config/restriction_queries/{restriction_query_id} |
| uk1.datadoghq.com | PUT https://api.uk1.datadoghq.com/api/v2/logs/config/restriction_queries/{restriction_query_id} |
| app.ddog-gov.com  | PUT https://api.ddog-gov.com/api/v2/logs/config/restriction_queries/{restriction_query_id}      |
| us2.ddog-gov.com  | PUT https://api.us2.ddog-gov.com/api/v2/logs/config/restriction_queries/{restriction_query_id}  |

## [制限クエリを削除する](https://dnd37xeb23o8n.cloudfront.net/jen.gilbert/astro-base/ja/api/latest/logs-restriction-queries/delete-a-restriction-query.md) (preview)

| Datadog site      | API endpoint                                                                                       |
| ----------------- | -------------------------------------------------------------------------------------------------- |
| app.datadoghq.com | DELETE https://api.datadoghq.com/api/v2/logs/config/restriction_queries/{restriction_query_id}     |
| us3.datadoghq.com | DELETE https://api.us3.datadoghq.com/api/v2/logs/config/restriction_queries/{restriction_query_id} |
| us5.datadoghq.com | DELETE https://api.us5.datadoghq.com/api/v2/logs/config/restriction_queries/{restriction_query_id} |
| app.datadoghq.eu  | DELETE https://api.datadoghq.eu/api/v2/logs/config/restriction_queries/{restriction_query_id}      |
| ap1.datadoghq.com | DELETE https://api.ap1.datadoghq.com/api/v2/logs/config/restriction_queries/{restriction_query_id} |
| ap2.datadoghq.com | DELETE https://api.ap2.datadoghq.com/api/v2/logs/config/restriction_queries/{restriction_query_id} |
| uk1.datadoghq.com | DELETE https://api.uk1.datadoghq.com/api/v2/logs/config/restriction_queries/{restriction_query_id} |
| app.ddog-gov.com  | DELETE https://api.ddog-gov.com/api/v2/logs/config/restriction_queries/{restriction_query_id}      |
| us2.ddog-gov.com  | DELETE https://api.us2.ddog-gov.com/api/v2/logs/config/restriction_queries/{restriction_query_id}  |

## [制限クエリのロールを一覧表示する](https://dnd37xeb23o8n.cloudfront.net/jen.gilbert/astro-base/ja/api/latest/logs-restriction-queries/list-roles-for-a-restriction-query.md) (preview)

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

## [制限クエリにロールを付与する](https://dnd37xeb23o8n.cloudfront.net/jen.gilbert/astro-base/ja/api/latest/logs-restriction-queries/grant-role-to-a-restriction-query.md) (preview)

| Datadog site      | API endpoint                                                                                           |
| ----------------- | ------------------------------------------------------------------------------------------------------ |
| app.datadoghq.com | POST https://api.datadoghq.com/api/v2/logs/config/restriction_queries/{restriction_query_id}/roles     |
| us3.datadoghq.com | POST https://api.us3.datadoghq.com/api/v2/logs/config/restriction_queries/{restriction_query_id}/roles |
| us5.datadoghq.com | POST https://api.us5.datadoghq.com/api/v2/logs/config/restriction_queries/{restriction_query_id}/roles |
| app.datadoghq.eu  | POST https://api.datadoghq.eu/api/v2/logs/config/restriction_queries/{restriction_query_id}/roles      |
| ap1.datadoghq.com | POST https://api.ap1.datadoghq.com/api/v2/logs/config/restriction_queries/{restriction_query_id}/roles |
| ap2.datadoghq.com | POST https://api.ap2.datadoghq.com/api/v2/logs/config/restriction_queries/{restriction_query_id}/roles |
| uk1.datadoghq.com | POST https://api.uk1.datadoghq.com/api/v2/logs/config/restriction_queries/{restriction_query_id}/roles |
| app.ddog-gov.com  | POST https://api.ddog-gov.com/api/v2/logs/config/restriction_queries/{restriction_query_id}/roles      |
| us2.ddog-gov.com  | POST https://api.us2.ddog-gov.com/api/v2/logs/config/restriction_queries/{restriction_query_id}/roles  |

## [制限クエリからロールを取り消す](https://dnd37xeb23o8n.cloudfront.net/jen.gilbert/astro-base/ja/api/latest/logs-restriction-queries/revoke-role-from-a-restriction-query.md) (preview)

| Datadog site      | API endpoint                                                                                             |
| ----------------- | -------------------------------------------------------------------------------------------------------- |
| app.datadoghq.com | DELETE https://api.datadoghq.com/api/v2/logs/config/restriction_queries/{restriction_query_id}/roles     |
| us3.datadoghq.com | DELETE https://api.us3.datadoghq.com/api/v2/logs/config/restriction_queries/{restriction_query_id}/roles |
| us5.datadoghq.com | DELETE https://api.us5.datadoghq.com/api/v2/logs/config/restriction_queries/{restriction_query_id}/roles |
| app.datadoghq.eu  | DELETE https://api.datadoghq.eu/api/v2/logs/config/restriction_queries/{restriction_query_id}/roles      |
| ap1.datadoghq.com | DELETE https://api.ap1.datadoghq.com/api/v2/logs/config/restriction_queries/{restriction_query_id}/roles |
| ap2.datadoghq.com | DELETE https://api.ap2.datadoghq.com/api/v2/logs/config/restriction_queries/{restriction_query_id}/roles |
| uk1.datadoghq.com | DELETE https://api.uk1.datadoghq.com/api/v2/logs/config/restriction_queries/{restriction_query_id}/roles |
| app.ddog-gov.com  | DELETE https://api.ddog-gov.com/api/v2/logs/config/restriction_queries/{restriction_query_id}/roles      |
| us2.ddog-gov.com  | DELETE https://api.us2.ddog-gov.com/api/v2/logs/config/restriction_queries/{restriction_query_id}/roles  |

## [特定のユーザーのすべての制限クエリを取得する](https://dnd37xeb23o8n.cloudfront.net/jen.gilbert/astro-base/ja/api/latest/logs-restriction-queries/get-all-restriction-queries-for-a-given-user.md) (preview)

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

## [特定のロールの制限クエリを取得する](https://dnd37xeb23o8n.cloudfront.net/jen.gilbert/astro-base/ja/api/latest/logs-restriction-queries/get-restriction-query-for-a-given-role.md) (preview)

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