Skip to content

Commit 07a6a70

Browse files
committed
Doc:Add monitoring and management to API key security content
1 parent 1c3d3b8 commit 07a6a70

File tree

2 files changed

+102
-2
lines changed

2 files changed

+102
-2
lines changed

docs/static/security/api-keys.asciidoc

Lines changed: 102 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,20 @@ access to {es} resources. You can set API keys to expire at a certain time,
77
and you can explicitly invalidate them. Any user with the `manage_api_key`
88
or `manage_own_api_key` cluster privilege can create API keys.
99

10-
Note that API keys are tied to the cluster they are created in. If you are
10+
Tips for creating API keys:
11+
12+
* API keys are tied to the cluster they are created in. If you are
1113
sending output to different clusters, be sure to create the correct kind of API
1214
key.
1315

16+
* {ls} can send both collected data and monitoring information to {es}. If you are
17+
sending both to the same cluster, you can use the same API key. For different
18+
clusters, you need an API key per cluster.
19+
20+
* A single cluster can share a key for ingestion and monitoring purposes.
21+
22+
* A production cluster and a monitoring cluster require separate keys.
23+
1424
NOTE: For security reasons, we recommend using a unique API key per {ls} instance.
1525
You can create as many API keys per user as necessary.
1626

@@ -176,6 +186,97 @@ filter {
176186
<1> Format is `id:api_key` (as returned by {ref}/security-api-create-api-key.html[Create API key])
177187

178188

189+
[float]
190+
[[ls-api-key-monitor]]
191+
====== Create an API key for monitoring
192+
193+
To create an API key to use for sending monitoring data to {es}, use the
194+
{ref}/security-api-create-api-key.html[Create API key API]. For example:
195+
196+
[source,console,subs="attributes,callouts"]
197+
------------------------------------------------------------
198+
POST /_security/api_key
199+
{
200+
"name": "logstash_host001", <1>
201+
"role_descriptors": {
202+
"logstash_monitoring": { <2>
203+
"cluster": ["monitor"],
204+
"index": [
205+
{
206+
"names": [".monitoring-ls-*"],
207+
"privileges": ["create_index", "create"]
208+
}
209+
]
210+
}
211+
}
212+
}
213+
------------------------------------------------------------
214+
<1> Name of the API key
215+
<2> Granted privileges
216+
217+
The return value should look similar to this:
218+
219+
[source,console-result,subs="attributes,callouts"]
220+
--------------------------------------------------
221+
{
222+
"id":"TiNAGG4BaaMdaH1tRfuU", <1>
223+
"name":"logstash_host001",
224+
"api_key":"KnR6yE41RrSowb0kQ0HWoA" <2>
225+
}
226+
--------------------------------------------------
227+
<1> Unique id for this API key
228+
<2> Generated API key
229+
230+
Now you can use this API key in your logstash.yml configuration file:
231+
["source","yml",subs="attributes"]
232+
--------------------
233+
xpack.monitoring.elasticsearch.api_key: TiNAGG4BaaMdaH1tRfuU:KnR6yE41RrSowb0kQ0HWoA <1>
234+
--------------------
235+
<1> Format is `id:api_key` (as returned by {ref}/security-api-create-api-key.html[Create API key])
236+
237+
238+
[float]
239+
[[ls-api-key-man]]
240+
====== Create an API key for management
241+
242+
[source,console,subs="attributes,callouts"]
243+
------------------------------------------------------------
244+
POST /_security/api_key
245+
{
246+
"name": "logstash_host001", <1>
247+
"role_descriptors": {
248+
"logstash_monitoring": { <2>
249+
"cluster": ["monitor"],
250+
"index": ["read"]
251+
}
252+
}
253+
}
254+
------------------------------------------------------------
255+
<1> Name of the API key
256+
<2> Granted privileges
257+
258+
The return value should look similar to this:
259+
260+
[source,console-result,subs="attributes,callouts"]
261+
--------------------------------------------------
262+
{
263+
"id":"TiNAGG4BaaMdaH1tRfuU", <1>
264+
"name":"logstash_host001",
265+
"api_key":"KnR6yE41RrSowb0kQ0HWoA" <2>
266+
}
267+
--------------------------------------------------
268+
<1> Unique id for this API key
269+
<2> Generated API key
270+
271+
Now you can use this API key in your logstash.yml configuration file:
272+
["source","yml",subs="attributes"]
273+
--------------------
274+
xpack.management.elasticsearch.api_key: TiNAGG4BaaMdaH1tRfuU:KnR6yE41RrSowb0kQ0HWoA <1>
275+
--------------------
276+
<1> Format is `id:api_key` (as returned by
277+
{ref}/security-api-create-api-key.html[Create API key])
278+
279+
179280
[float]
180281
[[learn-more-api-keys]]
181282
===== Learn more about API keys

docs/static/settings/configuration-management-settings.asciidoc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,5 @@ provides access to `.logstash-*` indices for managing configurations.
103103
`xpack.management.elasticsearch.api_key`::
104104

105105
Authenticate using an Elasticsearch API key. Note that this option also requires using SSL.
106-
107106
The API key Format is `id:api_key` where `id` and `api_key` are as returned by the Elasticsearch
108107
https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-api-key.html[Create API key API].

0 commit comments

Comments
 (0)