{"meta":{"title":"Using workflow run logs","intro":"You can view, search, and download the logs for each job in a workflow run.","product":"GitHub Actions","breadcrumbs":[{"href":"/en/actions","title":"GitHub Actions"},{"href":"/en/actions/how-tos","title":"How-tos"},{"href":"/en/actions/how-tos/monitor-workflows","title":"Monitor workflows"},{"href":"/en/actions/how-tos/monitor-workflows/use-workflow-run-logs","title":"Use workflow run logs"}],"documentType":"article"},"body":"# Using workflow run logs\n\nYou can view, search, and download the logs for each job in a workflow run.\n\nYou can see whether a workflow run is in progress or complete from the workflow run page. You must be logged in to a GitHub account to view workflow run information, including for public repositories. For more information, see [Access permissions on GitHub](/en/get-started/learning-about-github/access-permissions-on-github).\n\nIf the run is complete, you can see whether the result was a success, failure, canceled, or neutral. If the run failed, you can view and search the build logs to diagnose the failure and re-run the workflow. You can also view billable job execution minutes, or download logs and build artifacts.\n\nGitHub Actions use the Checks API to output statuses, results, and logs for a workflow. GitHub creates a new check suite for each workflow run. The check suite contains a check run for each job in the workflow, and each job includes steps. GitHub Actions are run as a step in a workflow. For more information about the Checks API, see [REST API endpoints for checks](/en/rest/checks).\n\n> \\[!NOTE]\n> Ensure that you only commit valid workflow files to your repository. If `.github/workflows` contains an invalid workflow file, GitHub Actions generates a failed workflow run for every new commit.\n\n## Viewing logs to diagnose failures\n\nIf your workflow run fails, you can see which step caused the failure and review the failed step's build logs to troubleshoot. You can see the time it took for each step to run. You can also copy a permalink to a specific line in the log file to share with your team. Read access to the repository is required to perform these steps.\n\nIn addition to the steps configured in the workflow file, GitHub adds two additional steps to each job to set up and complete the job's execution. These steps are logged in the workflow run with the names \"Set up job\" and \"Complete job\".\n\nFor jobs run on GitHub-hosted runners, \"Set up job\" records details of the runner image, and includes a link to the list of preinstalled tools that were present on the runner machine.\n\n1. On GitHub, navigate to the main page of the repository.\n2. Under your repository name, click **<svg version=\"1.1\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" class=\"octicon octicon-play\" aria-label=\"play\" role=\"img\"><path d=\"M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Zm4.879-2.773 4.264 2.559a.25.25 0 0 1 0 .428l-4.264 2.559A.25.25 0 0 1 6 10.559V5.442a.25.25 0 0 1 .379-.215Z\"></path></svg> Actions**.\n\n   ![Screenshot of the tabs for the \"github/docs\" repository. The \"Actions\" tab is highlighted with an orange outline.](/assets/images/help/repository/actions-tab-global-nav-update.png)\n3. In the left sidebar, click the workflow you want to see.\n\n   ![Screenshot of the left sidebar of the \"Actions\" tab. A workflow, \"CodeQL,\" is outlined in dark orange.](/assets/images/help/actions/superlinter-workflow-sidebar.png)\n4. From the list of workflow runs, click the name of the run to see the workflow run summary.\n5. Under **Jobs** or in the visualization graph, click the job you want to see.\n6. Any failed steps are automatically expanded to display the results.\n7. Optionally, to get a link to a specific line in the logs, click on the step's line number. You can then copy the link from the address bar of your web browser.\n\n   ![Screenshot of the logs for a job. The logs for a failed step are expanded, and a line number is highlighted with an orange outline.](/assets/images/help/repository/copy-link-button-updated-2.png)\n\n## Searching logs\n\nYou can search the build logs for a particular step. When you search logs, only expanded steps are included in the results. Read access to the repository is required to perform these steps.\n\n1. On GitHub, navigate to the main page of the repository.\n2. Under your repository name, click **<svg version=\"1.1\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" class=\"octicon octicon-play\" aria-label=\"play\" role=\"img\"><path d=\"M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Zm4.879-2.773 4.264 2.559a.25.25 0 0 1 0 .428l-4.264 2.559A.25.25 0 0 1 6 10.559V5.442a.25.25 0 0 1 .379-.215Z\"></path></svg> Actions**.\n\n   ![Screenshot of the tabs for the \"github/docs\" repository. The \"Actions\" tab is highlighted with an orange outline.](/assets/images/help/repository/actions-tab-global-nav-update.png)\n3. In the left sidebar, click the workflow you want to see.\n\n   ![Screenshot of the left sidebar of the \"Actions\" tab. A workflow, \"CodeQL,\" is outlined in dark orange.](/assets/images/help/actions/superlinter-workflow-sidebar.png)\n4. From the list of workflow runs, click the name of the run to see the workflow run summary.\n5. Under **Jobs** or in the visualization graph, click the job you want to see.\n6. In the upper-right corner of the log output, in the **Search logs** search box, type a search query.\n\n## Downloading logs\n\nYou can download the log files from your workflow run. You can also download a workflow's artifacts. For more information, see [Store and share data with workflow artifacts](/en/actions/using-workflows/storing-workflow-data-as-artifacts). Read access to the repository is required to perform these steps.\n\n1. On GitHub, navigate to the main page of the repository.\n2. Under your repository name, click **<svg version=\"1.1\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" class=\"octicon octicon-play\" aria-label=\"play\" role=\"img\"><path d=\"M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Zm4.879-2.773 4.264 2.559a.25.25 0 0 1 0 .428l-4.264 2.559A.25.25 0 0 1 6 10.559V5.442a.25.25 0 0 1 .379-.215Z\"></path></svg> Actions**.\n\n   ![Screenshot of the tabs for the \"github/docs\" repository. The \"Actions\" tab is highlighted with an orange outline.](/assets/images/help/repository/actions-tab-global-nav-update.png)\n3. In the left sidebar, click the workflow you want to see.\n\n   ![Screenshot of the left sidebar of the \"Actions\" tab. A workflow, \"CodeQL,\" is outlined in dark orange.](/assets/images/help/actions/superlinter-workflow-sidebar.png)\n4. From the list of workflow runs, click the name of the run to see the workflow run summary.\n5. Under **Jobs** or in the visualization graph, click the job you want to see.\n6. In the upper right corner of the log, select the <svg version=\"1.1\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" class=\"octicon octicon-gear\" aria-label=\"Show options\" role=\"img\"><path d=\"M8 0a8.2 8.2 0 0 1 .701.031C9.444.095 9.99.645 10.16 1.29l.288 1.107c.018.066.079.158.212.224.231.114.454.243.668.386.123.082.233.09.299.071l1.103-.303c.644-.176 1.392.021 1.82.63.27.385.506.792.704 1.218.315.675.111 1.422-.364 1.891l-.814.806c-.049.048-.098.147-.088.294.016.257.016.515 0 .772-.01.147.038.246.088.294l.814.806c.475.469.679 1.216.364 1.891a7.977 7.977 0 0 1-.704 1.217c-.428.61-1.176.807-1.82.63l-1.102-.302c-.067-.019-.177-.011-.3.071a5.909 5.909 0 0 1-.668.386c-.133.066-.194.158-.211.224l-.29 1.106c-.168.646-.715 1.196-1.458 1.26a8.006 8.006 0 0 1-1.402 0c-.743-.064-1.289-.614-1.458-1.26l-.289-1.106c-.018-.066-.079-.158-.212-.224a5.738 5.738 0 0 1-.668-.386c-.123-.082-.233-.09-.299-.071l-1.103.303c-.644.176-1.392-.021-1.82-.63a8.12 8.12 0 0 1-.704-1.218c-.315-.675-.111-1.422.363-1.891l.815-.806c.05-.048.098-.147.088-.294a6.214 6.214 0 0 1 0-.772c.01-.147-.038-.246-.088-.294l-.815-.806C.635 6.045.431 5.298.746 4.623a7.92 7.92 0 0 1 .704-1.217c.428-.61 1.176-.807 1.82-.63l1.102.302c.067.019.177.011.3-.071.214-.143.437-.272.668-.386.133-.066.194-.158.211-.224l.29-1.106C6.009.645 6.556.095 7.299.03 7.53.01 7.764 0 8 0Zm-.571 1.525c-.036.003-.108.036-.137.146l-.289 1.105c-.147.561-.549.967-.998 1.189-.173.086-.34.183-.5.29-.417.278-.97.423-1.529.27l-1.103-.303c-.109-.03-.175.016-.195.045-.22.312-.412.644-.573.99-.014.031-.021.11.059.19l.815.806c.411.406.562.957.53 1.456a4.709 4.709 0 0 0 0 .582c.032.499-.119 1.05-.53 1.456l-.815.806c-.081.08-.073.159-.059.19.162.346.353.677.573.989.02.03.085.076.195.046l1.102-.303c.56-.153 1.113-.008 1.53.27.161.107.328.204.501.29.447.222.85.629.997 1.189l.289 1.105c.029.109.101.143.137.146a6.6 6.6 0 0 0 1.142 0c.036-.003.108-.036.137-.146l.289-1.105c.147-.561.549-.967.998-1.189.173-.086.34-.183.5-.29.417-.278.97-.423 1.529-.27l1.103.303c.109.029.175-.016.195-.045.22-.313.411-.644.573-.99.014-.031.021-.11-.059-.19l-.815-.806c-.411-.406-.562-.957-.53-1.456a4.709 4.709 0 0 0 0-.582c-.032-.499.119-1.05.53-1.456l.815-.806c.081-.08.073-.159.059-.19a6.464 6.464 0 0 0-.573-.989c-.02-.03-.085-.076-.195-.046l-1.102.303c-.56.153-1.113.008-1.53-.27a4.44 4.44 0 0 0-.501-.29c-.447-.222-.85-.629-.997-1.189l-.289-1.105c-.029-.11-.101-.143-.137-.146a6.6 6.6 0 0 0-1.142 0ZM11 8a3 3 0 1 1-6 0 3 3 0 0 1 6 0ZM9.5 8a1.5 1.5 0 1 0-3.001.001A1.5 1.5 0 0 0 9.5 8Z\"></path></svg> dropdown menu, then click **Download log archive**.\n\n   ![Screenshot of the log for a job. In the header, a gear icon is outlined in dark orange.](/assets/images/help/actions/download-logs-drop-down.png)\n\n> \\[!NOTE]\n> When you download the log archive for a workflow that was partially re-run, the archive only includes the jobs that were re-run. To get a complete set of logs for jobs that were run from a workflow, you must download the log archives for the previous run attempts that ran the other jobs.\n\n## Deleting logs\n\nYou can delete the log files from your workflow runs through the GitHub web interface or programmatically. Write access to the repository is required to perform these steps.\n\n### Deleting logs via the GitHub web interface\n\n1. On GitHub, navigate to the main page of the repository.\n\n2. Under your repository name, click **<svg version=\"1.1\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" class=\"octicon octicon-play\" aria-label=\"play\" role=\"img\"><path d=\"M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Zm4.879-2.773 4.264 2.559a.25.25 0 0 1 0 .428l-4.264 2.559A.25.25 0 0 1 6 10.559V5.442a.25.25 0 0 1 .379-.215Z\"></path></svg> Actions**.\n\n   ![Screenshot of the tabs for the \"github/docs\" repository. The \"Actions\" tab is highlighted with an orange outline.](/assets/images/help/repository/actions-tab-global-nav-update.png)\n\n3. In the left sidebar, click the workflow you want to see.\n\n   ![Screenshot of the left sidebar of the \"Actions\" tab. A workflow, \"CodeQL,\" is outlined in dark orange.](/assets/images/help/actions/superlinter-workflow-sidebar.png)\n\n4. From the list of workflow runs, click the name of the run to see the workflow run summary.\n\n5. In the upper-right corner, select the <svg version=\"1.1\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" class=\"octicon octicon-kebab-horizontal\" aria-label=\"Show workflow options\" role=\"img\"><path d=\"M8 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3ZM1.5 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm13 0a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z\"></path></svg> dropdown menu, then click **Delete all logs**.\n\n   ![Screenshot of the page for a workflow run. In the top-right corner, a button, labeled with a kebab icon, is outlined in dark orange.](/assets/images/help/actions/workflow-run-kebab-horizontal-icon.png)\n\n6. Review the confirmation prompt.\n\nAfter deleting logs, the **Delete all logs** button is removed to indicate that no log files remain in the workflow run.\n\n### Deleting logs programmatically\n\nYou can use the following script to automatically delete all logs for a workflow. This can be a useful way to clean up logs for multiple workflow runs.\n\nTo run the example script below:\n\n1. Copy the code example and save it to a file called `delete-logs.sh`.\n2. Grant it the execute permission with `chmod +x delete-logs.sh`.\n3. Run the following command, where `REPOSITORY_NAME` is the name of your repository and `WORKFLOW_NAME` is the file name of your workflow.\n\n   ```shell copy\n   ./delete-logs.sh REPOSITORY_NAME WORKFLOW_NAME\n   ```\n\n   For example, to delete all of the logs in the `monalisa/octocat` repository for the `.github/workflows/ci.yaml` workflow, you would run `./delete-logs.sh monalisa/octocat ci.yaml`.\n\n#### Example script\n\n```bash copy\n#!/usr/bin/env bash\n\n# Delete all logs for a given workflow\n# Usage: delete-logs.sh <repository> <workflow-name>\n\nset -oe pipefail\n\nREPOSITORY=$1\nWORKFLOW_NAME=$2\n\n# Validate arguments\nif [[ -z \"$REPOSITORY\" ]]; then\n  echo \"Repository is required\"\n  exit 1\nfi\n\nif [[ -z \"$WORKFLOW_NAME\" ]]; then\n  echo \"Workflow name is required\"\n  exit 1\nfi\n\necho \"Getting all completed runs for workflow $WORKFLOW_NAME in $REPOSITORY\"\n\nRUNS=$(\n  gh api \\\n    -H \"Accept: application/vnd.github+json\" \\\n    -H \"X-GitHub-Api-Version: 2022-11-28\" \\\n    \"/repos/$REPOSITORY/actions/workflows/$WORKFLOW_NAME/runs\" \\\n    --paginate \\\n    --jq '.workflow_runs[] | select(.conclusion != \"\") | .id'\n)\n\necho \"Found $(echo \"$RUNS\" | wc -l) completed runs for workflow $WORKFLOW_NAME\"\n\n# Delete logs for each run\nfor RUN in $RUNS; do\n  echo \"Deleting logs for run $RUN\"\n  gh api \\\n    --silent \\\n    --method DELETE \\\n    -H \"Accept: application/vnd.github+json\" \\\n    -H \"X-GitHub-Api-Version: 2022-11-28\" \\\n    \"/repos/$REPOSITORY/actions/runs/$RUN/logs\" || echo \"Failed to delete logs for run $RUN\"\n\n  # Sleep for 100ms to avoid rate limiting\n  sleep 0.1\ndone\n```\n\n## Viewing logs with GitHub CLI\n\n> \\[!NOTE]\n> To learn more about GitHub CLI, see [About GitHub CLI](/en/github-cli/github-cli/about-github-cli).\n\nTo view the log for a specific job, use the `run view` subcommand. Replace `run-id` with the ID of run that you want to view logs for. GitHub CLI returns an interactive menu for you to choose a job from the run. If you don't specify `run-id`, GitHub CLI returns an interactive menu for you to choose a recent run, and then returns another interactive menu for you to choose a job from the run.\n\n```shell\ngh run view RUN_ID --log\n```\n\nYou can also use the `--job` flag to specify a job ID. Replace `job-id` with the ID of the job that you want to view logs for.\n\n```shell\ngh run view --job JOB_ID --log\n```\n\nYou can use `grep` to search the log. For example, this command will return all log entries that contain the word `error`.\n\n```shell\ngh run view --job JOB_ID --log | grep error\n```\n\nTo filter the logs for any failed steps, use `--log-failed` instead of `--log`.\n\n```shell\ngh run view --job JOB_ID --log-failed\n```"}