How to extract platform application logs from Tanzu Hub
search cancel

How to extract platform application logs from Tanzu Hub

book

Article ID: 443312

calendar_today

Updated On:

Products

VMware Tanzu Platform Core

Issue/Introduction

There is currently no native "Download" or "Export" button for application logs within the Tanzu Hub User Interface (UI). Users need a way to extract these logs for external analysis or compliance retention.

Environment

Tanzu Hub

Resolution

You can extract platform application logs by directly querying the Tanzu Hub GraphQL endpoint.

Prerequisites: How to find your Foundation Instance ID and App GUID

Before running the log query, you need the unique URN (entityId) for your application. This is structured as: vrn/provider:TAS/instance:<FOUNDATION_ID>/Application:<APP_GUID>

To find these values:

  1. Navigate to Tanzu Hub UI > Inventory (or Search).

  2. Search for your specific Application or the Tanzu Application Service (TAS) Foundation.

  3. Click on the entity to open its details page.

  4. Look at the browser's URL bar or the entity properties pane to extract the instance ID (e.g., p-bosh-4b45e6bdefc221a57a34) and the Application GUID.

Step-by-Step Procedure

  1. Get your Access Token: Log into the Tanzu Hub UI, click the Tools (Wrench Icon) in the top right, and select Access Token (Raw). Copy the entire token string.

  2. Configure the Query Variables: Create a file named payload.json on your local machine and paste both your query and variables into it like this:

    {
      "query": "query getObsLogResults($namespace: String!, $startTime: DateTime, $endTime: DateTime, $entityId: [EntityId!], $queryFilter: QueryFilter, $first: Int! = 50, $after: String, $sortOrder: QuerySortOrder) { observabilityQuery { queryLogs(after: $after, entityId: $entityId, first: $first, input: {queryTime: {startTime: $startTime, endTime: $endTime}, namespace: $namespace, queryFilter: $queryFilter, sortOrder: $sortOrder}) { logRecords { fields { key value } } pageInfo { endCursor hasNextPage } } } }",
      "variables": {
        "first": 500,
        "namespace": "Observability",
        "queryFilter": {"and": [], "or": []},
        "startTime": "2026-06-08T07:04:36Z",
        "endTime": "2026-06-08T13:04:36Z",
        "entityId": ["vrn/provider:TAS/instance:p-bosh-4b45e6bdefc221a57a34/Application:8b21f91f-1350-422e-b228-86bf70f9466f"],
        "after": "",
      "sortOrder": "ASC"
      }
    }
  3. Modify Query Variables: modify fist(rows to return), startTime, endTime and entityID (from prerequisite). 

  4. Run Query and Export to File: 

    curl -X POST https://hub.<DOMAIN>/hub/graphql \
      -H "Content-Type: application/json" \
      -H "authorization: Bearer <TOKEN>" \
      -d @payload.json \
      > app_logs.json