Skip to content
Exlogare

CircleCI ingest

Send CircleCI job logs to Exlogare via a "when on_fail" step.

Exlogare’s POST /api/ingest/circleci endpoint accepts the failed-job log of a CircleCI run and returns an RCA. The integration is a single when: on_fail step inside any job.

Required fields

FieldTypeNotes
project_slugstringe.g. gh/myorg/myrepo (CircleCI project slug).
workflow_idstringCIRCLE_WORKFLOW_ID (UUID).
job_namestringCIRCLE_JOB.
job_numberintCIRCLE_BUILD_NUM.
statusstringfailed / error / etc. — see below.
logstringFailed-step log, up to 10 MiB.
branch, commit_sha, pipeline_url, workflow_nameoptional

Allowed status values (case-insensitive): success, failed, failing, error, errored, canceled, cancelled, timedout, unauthorized, blocked, running.

Job step

Add an EXLOGARE_TOKEN context (or per-project env var) and an on-fail step that captures the previous step’s stdout:

version: 2.1

jobs:
  test:
    docker:
      - image: cimg/python:3.12
    steps:
      - checkout
      - run:
          name: Run tests
          command: |
            set -o pipefail
            pytest -q 2>&1 | tee /tmp/build.log
      - run:
          name: Send failure log to Exlogare
          when: on_fail
          command: |
            sudo apt-get update && sudo apt-get install -y jq
            curl -fsS -X POST https://api.exlogare.net/api/ingest/circleci \
              -H "Authorization: Bearer $EXLOGARE_TOKEN" \
              -H "Content-Type: application/json" \
              -d "$(jq -n \
                --arg ps   "gh/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME" \
                --arg wf   "$CIRCLE_WORKFLOW_ID" \
                --arg wn   "$CIRCLE_WORKFLOW_JOB_ID" \
                --arg job  "$CIRCLE_JOB" \
                --arg br   "$CIRCLE_BRANCH" \
                --arg sha  "$CIRCLE_SHA1" \
                --arg url  "$CIRCLE_BUILD_URL" \
                --arg log  "$(cat /tmp/build.log)" \
                '{project_slug:$ps, workflow_id:$wf, job_name:$job, job_number:'$CIRCLE_BUILD_NUM', status:"failed", branch:$br, commit_sha:$sha, pipeline_url:$url, log:$log}')"

workflows:
  ci:
    jobs:
      - test:
          context: exlogare

Server (self-hosted)

The endpoint shape is identical for CircleCI Server. Substitute the public hostname into pipeline_url if the customer-facing URL differs from the internal one.

Tips

  • Cache the jq install in a Docker image to avoid the apt step on every run.
  • Truncate the log to the last few MB if your test suite produces huge output: tail -c 9000000 /tmp/build.log before piping into jq.
  • Use a CircleCI context (not per-project env vars) so the same token works across many repos.