> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/harness-platform/use-harness-platform/pipelines/executions-and-logs/download-logs.md).

# 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

* How to [download pipeline logs](#download-pipeline-log-files) through the Harness UI.
* How to [download step logs](#download-step-log-files) for specific steps through the Harness UI.
* How to [download logs via API](#download-logs-using-api) using the Log Service API endpoint.

***

## 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](/harness-platform/new-to-harness-platform/get-started.md).
* **Pipeline execution permissions:** You need **View** permission on [Pipelines](/harness-platform/use-harness-platform/platform-access-control/permissions-reference.md#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](/harness-platform/use-harness-platform/platform-access-control.md) to understand role-based access control and [Manage roles](/harness-platform/use-harness-platform/platform-access-control/add-manage-roles.md) 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](/harness-platform/use-harness-platform/automation/api/add-and-manage-api-keys.md) 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](https://apidocs.harness.io/#section/Introduction/Authentication) to learn about API authentication.

{% hint style="warning" %}
Ensure the pipeline execution has completed before attempting to download logs. Downloading logs from a running execution may result in incomplete or missing log files.
{% endhint %}

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:

```json
{
  "link": "https://storage.googleapis.com/<STORAGE_PATH>/logs.zip?Expires=...",
  "status": "queued",
  "expires": "2026-04-13T18:24:23Z"
}
```

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:

```bash
curl 'https://app.harness.io/gateway/log-service/blob/download?accountID=ACCOUNT_ID&prefix=PIPELINE_EXECUTION_PREFIX_KEY' \
  -X 'POST' \
  -H 'content-type: application/json' \
  -H 'x-api-key: <HARNESS-PERSONAL-ACCESS-TOKEN>'
```

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:

```bash
curl 'https://app.harness.io/gateway/log-service/blob/download?accountID=ACCOUNT_ID&prefix=STEP_PREFIX_KEY' \
  -X 'POST' \
  -H 'content-type: application/json' \
  -H 'x-api-key: <HARNESS-PERSONAL-ACCESS-TOKEN>'
```

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.

### Use vanity URLs for download links

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:

```
34.82.155.149
34.168.179.66
```

Go to [Allowlist Harness domains and IPs](/harness-platform/use-harness-platform/references/allowlist-harness-domains-and-ips.md) to configure your allowlist.

***

## Next steps

* [View and compare pipeline executions](/harness-platform/use-harness-platform/pipelines/executions-and-logs/view-and-compare-pipeline-executions.md): View compiled YAML and compare execution differences.
* [Search the console view](/harness-platform/use-harness-platform/pipelines/executions-and-logs/searching-the-console-view.md): Search pipeline execution logs in the console view.
* [Troubleshoot pipeline executions](/harness-platform/use-harness-platform/pipelines/troubleshoot-pipeline-executions.md): Resolve issues with downloading or extracting execution logs.

{% @harness-feedback/feedback module="harness-ai" pagePath="harness-ai/use-harness-platform/pipelines/executions-and-logs/download-logs" %}
