TeamCity ingest
Send TeamCity build logs to Exlogare via a Build Failure Condition or service-message step.
Exlogare’s POST /api/ingest/teamcity endpoint accepts the build log of a failed TeamCity run and returns an RCA.
Required fields
| Field | Type | Notes |
|---|---|---|
build_type_id | string | TeamCity build configuration id (%system.teamcity.buildType.id%). |
build_id | int | Globally unique build id (%teamcity.build.id%). |
build_number | string | Display number (%system.build.number%). |
status | string | failure / success / error / cancelled / running. |
log | string | Failed-step log, up to 10 MiB. |
branch, commit_sha, build_url, project_name | optional |
Build step (recommended)
Add a final Command Line build step set to “Execute always (even if build is failed)” via Build Configuration → Steps → “Execute step”:
if [ "%system.teamcity.build.is.successful%" != "true" ]; then
curl -fsS -X POST https://api.exlogare.net/api/ingest/teamcity \
-H "Authorization: Bearer %env.EXLOGARE_TOKEN%" \
-H "Content-Type: application/json" \
-d "$(jq -n \
--arg bt '%system.teamcity.buildType.id%' \
--arg bn '%system.build.number%' \
--arg url '%teamcity.serverUrl%/buildConfiguration/%system.teamcity.buildType.id%/%teamcity.build.id%' \
--arg br '%teamcity.build.branch%' \
--arg sha '%build.vcs.number%' \
--arg pr '%system.teamcity.projectName%' \
--arg log "$(cat build.log)" \
'{build_type_id:$bt, build_id:'%teamcity.build.id%', build_number:$bn, status:"failure", branch:$br, commit_sha:$sha, build_url:$url, project_name:$pr, log:$log}')"
fi
Configure EXLOGARE_TOKEN as a project parameter of type Password.
Why a step instead of a Build Feature?
TeamCity’s Build Failure Conditions can mark a build as failed but cannot run an outbound HTTP call. The Build Feature ecosystem (e.g. Slack notifier) is plugin-based and not easy to drive from a static endpoint. A trailing step gives us:
- the failing log captured via
tee build.logfrom the previous step; - access to all
%system.*%parameters; - predictable retries and timeouts.
Tips
- TeamCity escapes
%aggressively — use single quotes around the parameter expansion to avoid double-evaluation. - Use a shared parameter in the project root so every child config inherits the same
EXLOGARE_TOKEN. - Mask the token with
##teamcity[setParameter name='env.EXLOGARE_TOKEN' value='<masked>']if you need to print debug output.