Examples
banshee/examples-collection/examples/api/
elasticsearch-key
Example: base64.encode for an API key header; the health of an Elasticsearch cluster.
par banshee1 installation1 version
Publiée le 27 octobre 2026. First version in this collection.
An API key of Elasticsearch
Elasticsearch accepts an API key in the header Authorization: ApiKey <base64 of id:key>. The collector writes it with base64.encode and reads the health of the cluster, green, yellow or red.
How to read it
base64.encode($id . ':' . $key): the bytes of the text in base64, the standard alphabet with its=padding.- The key is a variable declared
'secret' => true, so the encoded text is a secret too: anything computed from a secret is one. It goes into a header, never into a value or a message, and only overhttps://. - The answer is not a secret: the key went in a header, not in a body.
watch.stateraises a warning onyellow(a replica missing) and critical onred(a primary shard missing).
To adapt it
- OpenSearch with the security plugin takes an account in Basic instead:
user=andpassword=(seeexamples/protocols/http-get-account). - Any API that wants a value in base64 in a header follows the same line.