0Pricing
Elasticsearch & Full Text Search Systems · レッスン

APIキーと監査ログ

パスワードの代わりに権限範囲を限定したAPIキーでプログラムからのアクセスを保護し、Elasticsearchの監査ログを有効化・確認して誰が何をしたかを証明する方法を学びます。

「APIキーと監査ログ」はCoddyKit上の無料Elasticsearch & Full Text Search Systemsレッスンです。 これはレッスン4/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはElasticsearch & Full Text Search Systems学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Elasticsearch & Full Text Search Systemsコースには全4レッスンが含まれています。

このレッスンの一部はまだ翻訳されておらず、英語で表示されています。

Beyond Passwords

Applications should not authenticate with a human's username and password. Elasticsearch provides API keys: scoped, revocable credentials ideal for services. Pair them with audit logging to track every security-relevant action.

What Is an API Key

An API key is a credential tied to a set of permissions, with an optional expiration. It can be limited to a subset of the creating user's privileges, following the principle of least privilege.

Creating a Key

Use the create API key endpoint. The response includes an id and api_key value shown only once, so store it securely.

POST /_security/api_key
{
  "name": "logging-app",
  "expiration": "30d"
}

Restricting a Key

Attach role_descriptors to limit what the key can do, even if the creating user has more power. Here the key may only read one index.

POST /_security/api_key
{
  "name": "reader",
  "role_descriptors": {
    "ro": {
      "indices": [{ "names": ["logs-*"], "privileges": ["read"] }]
    }
  }
}

Using a Key

Send the base64-encoded id:api_key pair in the Authorization header with the ApiKey scheme.

GET /logs-2024/_search
Authorization: ApiKey VnVhQ2ZHY0JDZGJrU...

Revoking Keys

Compromised or retired keys are invalidated immediately, without changing any user's password. You can revoke by id, by name, or all keys owned by a user.

DELETE /_security/api_key
{
  "name": "logging-app"
}

Why Audit Logging

Audit logs answer the compliance question: who did what, when, and from where. They record authentication attempts, access grants and denials, and configuration changes.

Enabling the Audit Log

Audit logging is turned on in elasticsearch.yml. It is disabled by default because it generates significant volume.

xpack.security.audit.enabled: true

Filtering Events

Tune which events are captured with include/exclude lists to avoid drowning in noise. Common choices keep access_denied and authentication_failed while dropping routine reads.

xpack.security.audit.logfile.events.exclude: [ access_granted ]

Reading Audit Output

Audit events are written as structured JSON to a dedicated log file. Each line includes the event type, user, client IP, request path, and outcome, making it easy to ship into Kibana for analysis.

Best Practices

Rotate API keys regularly, scope them tightly, store the audit log on durable storage separate from the cluster, and alert on repeated authentication_failed events that may signal an attack.

Quick Check

Test your understanding of API keys.

Recap

You learned to secure access and accountability:

  • API keys are scoped, expiring, revocable credentials for applications.
  • Use role_descriptors to enforce least privilege.
  • Audit logging records who did what, when, and from where.
  • Filter audit events to manage volume and alert on failed authentications.

よくある質問

「APIキーと監査ログ」レッスンは無料ですか?

はい。「APIキーと監査ログ」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Elasticsearch & Full Text Search Systemsコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Elasticsearch & Full Text Search Systemsコースには全4レッスンが含まれています。

「APIキーと監査ログ」で何を学びますか?

パスワードの代わりに権限範囲を限定したAPIキーでプログラムからのアクセスを保護し、Elasticsearchの監査ログを有効化・確認して誰が何をしたかを証明する方法を学びます。 ブラウザで直接実行するハンズオンコードでElasticsearch & Full Text Search Systemsを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。

Elasticsearch & Full Text Search Systemsを始めるのに経験は必要ですか?

事前経験は必要ありません。CoddyKitのElasticsearch & Full Text Search Systemsは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン4/4です。

「APIキーと監査ログ」レッスンにはどのくらい時間がかかりますか?

ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。

このElasticsearch & Full Text Search Systemsレッスンでコードを書いて実行できますか?

はい。すべてのElasticsearch & Full Text Search Systemsレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。

このコースのすべてのレッスン

  1. ユーザー認証とロール
  2. フィールドレベルおよびドキュメントレベルのセキュリティ
  3. TLS/SSLとネットワークセキュリティ
  4. APIキーと監査ログ
← Elasticsearch & Full Text Search Systemsに戻る