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.

  1. 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 '.'
    
  2. 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 '.'
    
  3. Create the encoded-base64-api-key with the following command. Keep "id": "LoRMmn4BCbCvoljFvMzq" and "api_key": "ZZEnRG93Q1i6wOCVW2XWug". These settings are needed to create the encoded-base64-api-key.

    echo -n "{id}:{api_key}" | base64
    

    For example, see the following example:

    echo -n "LoRMmn4BCbCvoljFvMzq:ZZEnRG93Q1i6wOCVW2XWug" | base64
    TG9STW1uNEJDYkN2b2xqRnZNenE6WlpFblJHOTNRMWk2d09DVlcyWFd1Zw==
    
  4. 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}}'
    
  5. Test the key with the IBM Cloud Pak for AIOps console:

    1. Create an ELK integration with api_key as encoded-base64-api-key.
    2. Test the integration.
    3. Turn on data collection and save.
    4. Finally, ensure that your integration is saved.