Generating an API Key for an ELK integration
When you are creating an ELK integration, you might need to generate an API key. Use the following procedure to generate the API Key.
Procedure
When you are completing these steps, replace the cluster and API key details with the details for your environment.
-
To check, or list, your existing
api_key
, run the following command:curl -k -X GET 'https://was911.myibm.com:9200/_security/api_key' -H 'Authorization: Basic ZWxhc3RpYzpwYXNzdzByZA==' | jq '.'
-
If you need to create an
api_key
, run the following command:curl -k -X POST 'https://was911.myibm.com:9200/_security/api_key' -H 'Content-Type: application/json' -H 'Authorization: Basic ZWxhc3RpYzpwYXNzdzByZA==' -d '{ "name": "my-api-key-sheikh-2", "role_descriptors": {} }' | jq '.'
-
Create the
encoded-base64-api-key
with the following command. Keep"id": "LoRMmn4BCbCvoljFvMzq"
and"api_key": "ZZEnRG93Q1i6wOCVW2XWug"
. These settings are needed to create theencoded-base64-api-key
.echo -n "{id}:{api_key}" | base64
For example, see the following example:
echo -n "LoRMmn4BCbCvoljFvMzq:ZZEnRG93Q1i6wOCVW2XWug" | base64 TG9STW1uNEJDYkN2b2xqRnZNenE6WlpFblJHOTNRMWk2d09DVlcyWFd1Zw==
-
Test the ELK query by using the
encoded-base64-api-key
:curl -k -X 'GET' 'https://was911.myibm.com:9200/my-index' -H 'accept: /' -H 'Authorization: ApiKey {encoded-base64-api-key}}'
-
Test the key with the IBM Cloud Pak for AIOps console:
- Create an ELK integration with
api_key
asencoded-base64-api-key
. - Test the integration.
- Turn on data collection and save.
- Finally, ensure that your integration is saved.
- Create an ELK integration with