IBM Cloud Docs
Retrieving tenant information in IBM Cloud Logs Routing

Retrieving tenant information in IBM Cloud Logs Routing

You can get information for a tenant that you define in IBM® Cloud Logs Routing.

A tenant is the account-specific configuration of IBM Cloud Logs Routing running within a region. The tenant configuration includes a maximum of 2 target definitions. The target defines where the logs are routed.

Before you begin

Complete the following steps:

  1. Review About IBM® Cloud Logs Routing to understand concepts.

  2. Install all prerequisite tools as described in the getting started.

  3. Set up permissions to manage targets in the account. For more information, see Setting up IAM permissions for managing tenants.

  4. To get details on a tenant by using the API, check that you can connect to IBM Cloud Logs Routing by using the management API. For more information, see Connecting to IBM® Cloud Logs Routing.

Getting the IAM bearer token

You must get an IBM Cloud® Identity and Access Management (IAM) access token to authenticate your requests to the IBM® Cloud Logs Routing service. For more information, see Retrieving an access token.

For example, you can retrieve your IAM bearer token and export it as an environment variable by running the following CLI command:

export IAM_TOKEN=`ibmcloud iam oauth-tokens --output json | jq -r '.iam_token'`

Choosing the management endpoint

A tenant is the account-specific configuration of IBM Cloud Logs Routing running within a region.

To get the details of a tenant in a region, you must use the management endpoint URL for the region where the tenant is configured.

You can use private or public endpoints.

For more information, see Management endpoint URLs.

Getting tenant information by using the API

Run the following command to get the details of a tenant in a region by using the private endpoint:

curl -X GET https://management.private.{REGION}.logs-router.cloud.ibm.com/v1/tenants \
-H "Authorization: ${IAM_TOKEN}" \
-H "IBM-API-Version: API_VERSION_DATE"

Run the following command to get the details of a tenant in a region by using the public endpoint:

curl -X GET https://management.{REGION}.logs-router.cloud.ibm.com/v1/tenants \
-H "Authorization: ${IAM_TOKEN}" \
-H "IBM-API-Version: API_VERSION_DATE"

Where

  • REGION defines the location where the tenant is configured.
  • IAM_TOKEN defines the credentials that you use to authenticate your requests.
  • API_VERSION_DATE defines the current date to request the latest version of the API. The valid format is YYYY-MM-DD. Any date up to the current date can be provided.

The following example shows how to get information about an IBM Cloud Logs Routing tenant in the us-east region by using a VPE:

curl -X GET https://management.private.us-east.logs-router.cloud.ibm.com/v1/tenants \
-H "Authorization: ${IAM_TOKEN}" \
-H "IBM-API-Version: 2024-03-01"

A successful request returns a response that contains a single tenant, for example:

{
  "id": "97543c-77b7-eg23-8114-999b31a2b3",
  "created_at": "2023-10-20T18:30:00.143156Z",
  "updated_at": "2023-10-20T18:30:00.143156Z",
  "crn": "crn:v1:bluemix:public:logs-router:eu-de:a/3516b8fa0a174a71899f5affa4f18d78:3517d2ed-9429-af34-ad52-34278391cbc8::",
  "name": "tenant",
  "etag": "\"822b4b5423e225206c1d75666595714a11925cd0f82b229839864443d6c3c049\"",
  "targets": [
    {
      "id": "86432b-66a6-df12-7003-888a21a2b3",
      "log_sink_crn": "crn:v1:bluemix:public:logdna:us-east:a/473958g47b35f1234:48b580c-34ad-c985-1g2g-e1g75b71a2b3::",
      "name": "my-log-sink",
      "etag": "\"c3a43545a7f2675970671ac3a57b8db067a1866b2222e1b950ee8da612e347c6\"",
      "type": "logdna",
      "created_at": "2023-10-20T18:30:00.143156Z",
      "updated_at": "2023-10-20T18:30:00.143156Z",
      "parameters": {
        "host": "logs.us-east.logging.cloud.ibm.com",
        "port": 443
      }
    }
  ]
}