For the complete documentation index, see llms.txt. This page is also available as Markdown.

Download execution logs

Download pipeline, stage, and step execution logs through the UI or API for offline analysis and troubleshooting.

You can download pipeline, stage, and step execution logs through the Harness UI or the Log Service API. Downloaded logs are provided as a .zip file containing log files in NDJSON (newline-delimited JSON) format, where each line is a standalone JSON object.


What you will learn from this topic


Before you begin

  • Harness account access: You need access to a Harness account with pipelines. For how to access or create a Harness account, see Getting started with Harness Platform.

  • Pipeline execution permissions: You need View permission on Pipelines to view and download execution logs. To get this permission, an administrator must assign you a role that includes it. Go to RBAC in Harness to understand role-based access control and Manage roles to configure role assignments.

  • Harness API token (for API downloads): To download logs via API, you need a valid Harness API token. Go to Add and manage API keys to create one.

  • Completed pipeline execution: Ensure the pipeline execution has completed before downloading logs. Downloading logs from a running execution may result in incomplete or missing log files.


Download and extraction considerations

Keep the following considerations in mind when downloading execution logs:

  • Download limit: You might encounter the error message Prefix Key Exceeds Maximum Download Limit if your download exceeds 100 log files. The download contains individual log files for each step and step sub-section in the execution.

  • Nested directory structure: The extracted files have many levels of nested directories. To locate specific log files, you might need to navigate through several levels.

  • Windows extraction issues: Windows users may encounter issues extracting logs.zip with the native extraction tool. Use a third-party tool such as 7-Zip or similar.

  • Delegate version requirement: Delegates with versions lower than 23.10.81010 may have issues with log streaming.


Download pipeline log files

Perform the following steps to download pipeline log files:

  1. Navigate to your pipeline in Harness.

  2. Select More Options (⋮) > Download Logs.

    Harness queries the log service, exports the log, and downloads the logs.zip file.

  3. Open the logs.zip file and extract the contents.

  4. Navigate through the extracted directory structure to locate the log you want to examine.


Download step log files

Perform the following steps to download step log files:

  1. Navigate to your pipeline in Harness.

  2. Select the step for which you want to download the execution log.

  3. Under Details, select the download icon.

    Harness queries the log service, exports the log, and downloads the logs.zip file.

  4. Open the logs.zip file and extract the contents.

  5. Navigate through the extracted directory structure to locate the log you want to examine.


Download logs using API

You can download pipeline, stage, and step execution logs via the Log Service API /log-service/blob/download endpoint. Authentication by Harness API token is required. Go to Harness API reference to learn about API authentication.

The log download endpoint is asynchronous. The initial response returns a queued status. You must poll the same endpoint until the status changes to success, at which point the link field contains the URL to download the logs.zip file.

Example API response:

Response fields:

  • link: The URL to download the logs.zip file.

  • status: The current state of the download request (queued, success).

  • expires: When the download link expires.

Download pipeline logs using API

Use the following cURL command to download pipeline log files based on the pipeline execution key:

Parameters:

  • ACCOUNT_ID: Your Harness account identifier.

  • PIPELINE_EXECUTION_PREFIX_KEY: A multi-part value consisting of ACCOUNT_ID/pipeline/PIPELINE_ID/RUN_SEQUENCE/-PLAN_EXECUTION_ID. For example, 12345abcd/pipeline/My_Cool_Pipeline/12/-dfstsh.

    • ACCOUNT_ID: Your Harness account identifier.

    • PIPELINE_ID: The identifier of the pipeline that you want to get logs for.

    • RUN_SEQUENCE: The incremental execution/build identifier of the specific pipeline run that you want logs for.

    • -PLAN_EXECUTION_ID: A hyphen (-) followed by the identifier of the pipeline execution that you want to get logs for.

  • TOKEN: Your Harness API token.

Download step logs using API

Use the following cURL command to download step log files based on the step key:

Parameters:

  • ACCOUNT_ID: Your Harness account identifier.

  • STEP_PREFIX_KEY: A multi-part value consisting of ACCOUNT_ID/pipeline/PIPELINE_ID/RUN_SEQUENCE/-PLAN_EXECUTION_ID/STAGE_ID/STEP_ID. For example, 12345abcd/pipeline/My_Cool_Pipeline/12/-dfstsh/My_Cool_Stage/My_Cool_Step.

    • ACCOUNT_ID: Your Harness account identifier.

    • PIPELINE_ID: The identifier of the pipeline that has the step that you want to get logs for.

    • RUN_SEQUENCE: The incremental execution/build identifier of a specific pipeline run.

    • -PLAN_EXECUTION_ID: A hyphen (-) followed by the identifier of the pipeline execution that you want to get logs for.

    • STAGE_ID: The identifier of the stage that has the step that you want to get logs for.

    • STEP_ID: The identifier of the step that you want to get logs for.

  • TOKEN: Your Harness API token.

By default, the generated download link for the logs.zip file uses a Harness URL, for example, https://app.harness.io/storage/harness-download/<PATH_TO_YOUR_LOG_KEY>. To use vanity URLs for the logs.zip file, add the following IP addresses to your account allowlist:

Go to Allowlist Harness domains and IPs to configure your allowlist.


Next steps

Last updated

Was this helpful?