The Simplest Way to Make Elasticsearch and Teamcity Work Like They Should
In production, elasticsearch and teamcity work together to store and search build logs. TeamCity runs your builds and sends log data to Elasticsearch for fast checks. Teams use this pair to spot failed tests and slow build steps fast. A good setup keeps build data safe and easy to search across projects. How data and roles flow between elasticsearch and teamcity TeamCity creates lots of text logs, test results, and build metrics every day. Built-in storage fills up fast when many build agent
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
In production, elasticsearch and teamcity work together to store and search build logs. TeamCity runs your builds and sends log data to Elasticsearch for fast checks.
Teams use this pair to spot failed tests and slow build steps fast. A good setup keeps build data safe and easy to search across projects.
How data and roles flow between elasticsearch and teamcity
TeamCity creates lots of text logs, test results, and build metrics every day. Built-in storage fills up fast when many build agents run at the same time.
To fix this, a log shipper or plugin reads build files from TeamCity. It formats each log line as JSON and sends it to an Elasticsearch index.
This flow needs a clear way to log in on both sides. TeamCity or the log shipper uses an API key or user role to write data. Elasticsearch checks that key before it accepts any new build records.
Engineers then log in to read those records and check broken builds. Each person or bot should have a separate role with clear limits. The build server only needs permission to write to specific log indices. Engineers only need permission to read logs for their own team projects.
Common failure modes and how to scope permissions
Many teams take shortcuts when they first link their build server to search clusters. A common mistake is using one shared admin account for all build agents. If one agent gets compromised, an attacker can read or delete the whole cluster.
Broad API keys are another big risk in build pipelines. Teams often create keys that never expire and can touch every index. When a key leaks in a build log, anyone can steal cluster data.
Elasticsearch Security + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Unlogged queries also cause trouble during security audits. When ten devs share one login to search build logs, you lose track of who ran which query. Build logs often hold sensitive details like emails, phone numbers, or card numbers from test data.
You can fix these issues with tight role rules and network limits. First, give your TeamCity shipper a role that only allows write actions. Restrict that role so it only writes to indices that start with a build prefix.
Second, set up index templates so new build logs get strict field types. This stops bad log formats from breaking your search cluster during a big release. Third, put both tools on a private network so public traffic cannot reach them. Only allow traffic from known build agent IP addresses to reach your search nodes.
Keeping build log searches safe for engineers
Even with good network rules, engineers still need to inspect raw build output. Sometimes a failed test dumps production-like strings or national IDs into the console log. If that text goes straight into your search index, every reader can see it.
Teams should review what TeamCity prints before it leaves the build agent. Masking tools can rewrite matched fields like emails or card numbers in results. This keeps your search index useful for debugging without exposing private test records.
You should also rotate the keys that TeamCity uses on a regular schedule. Short-lived credentials limit the damage if a build script prints a secret by mistake. Combine key rotation with clear audit logs for every search query run by your team.
Govern statements and responses across databases and APIs
Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.
First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.
Frequently asked questions
How does TeamCity send build logs to Elasticsearch?
A log shipper or server plugin reads TeamCity build logs as they finish. It sends those logs over HTTPS to an Elasticsearch index using an API key.
What permissions does TeamCity need in Elasticsearch?
TeamCity only needs permission to create and write documents in specific build log indices. It should never have admin rights or permission to delete old data.
How do we stop sensitive test data from leaking in build logs?
Use secret masking in TeamCity and data masking on your search queries. Data masking rewrites fields like emails, phone numbers, and card numbers in results.
Related guides
In this post