The Simplest Way to Make Buildkite and Elasticsearch Work Like They Should
Teams pair buildkite and elasticsearch to ship build logs and job metrics in real time. Buildkite runs your code tests while Elasticsearch stores and indexes the output for fast search. This workflow helps teams find broken builds and slow test steps in seconds. Engineers can query past job runs without clicking through hundreds of separate build pages. Good data flow between both tools turns raw text output into clear charts and alerts. How buildkite and elasticsearch share data and permissi
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.
Teams pair buildkite and elasticsearch to ship build logs and job metrics in real time. Buildkite runs your code tests while Elasticsearch stores and indexes the output for fast search.
This workflow helps teams find broken builds and slow test steps in seconds. Engineers can query past job runs without clicking through hundreds of separate build pages. Good data flow between both tools turns raw text output into clear charts and alerts.
How buildkite and elasticsearch share data and permissions
Buildkite uses a hybrid model where a cloud service schedules work on your own agents. Those agents run inside your network and run your build steps. During a job, the agent collects text output, timing numbers, and exit codes. A log shipper or agent hook then sends that data to your Elasticsearch cluster.
To make this work, the build agent must log in to the search cluster. Most teams create a dedicated service role inside Elasticsearch for these build agents. This role needs write permissions on specific log indices and nothing else. The agent reads an API key from a secret store before it sends any records. Once the cluster checks the key, it writes the build event to the target index.
Data flows in one direction for most logging setups. Build agents push JSON records over HTTPS to the cluster ingestion endpoint. In some test pipelines, a build step also queries Elasticsearch to check app behavior. Those read steps should use a separate role with read permissions on test indices only.
Common failure modes and how to scope access
Many teams start by sharing one broad admin key across every build agent. This shortcut creates a big security risk for your data platform. If a third-party script runs in a build, it can read that shared key. An attacker could then delete production indices or read private records from other indices.
Unlogged queries from build scripts also cause headaches during incident reviews. When twenty agents use the same static account, cluster logs cannot show which pipeline ran a bad query. Teams also hit trouble when build logs contain sensitive data like emails or card numbers. If raw build output goes straight to an index, anyone searching logs might find those secrets.
Elasticsearch Security + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
You can fix these issues by scoping roles and network paths between both systems. First, split your agents into groups based on trust levels, such as pull requests versus main deploys. Give each agent group its own API key and its own index pattern. A pull request agent should never have permissions to write to release metrics indices.
Next, lock down the network path so only known agent subnets can reach the cluster port. Set up index templates that drop or mask sensitive fields like phone numbers or national IDs. Always rotate your agent keys on a set schedule and remove unused service accounts.
Keeping build indices fast and clean
CI pipelines create huge amounts of text every single day. If you send every debug line to your search cluster, storage costs will climb fast. Large text blobs also slow down search speed for the rest of the team. You should filter out noisy debug lines before the agent sends the payload.
Break your build data into structured fields like pipeline name, branch, commit hash, and duration. Structured fields let teams filter failed jobs by branch or author in one click. Set up index lifecycle rules to delete raw build text after thirty days. You can keep small summary records for a full year to track long-term build speed.
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
Should build agents write straight to Elasticsearch or use a queue?
Direct writes work well for small teams with steady build volume. High-volume pipelines should put a message queue or log buffer between the agents and the cluster. A buffer stops sudden build spikes from overloading your search nodes.
How do we stop build logs from leaking secrets into search indices?
Use secret redaction features on your build agents before logs leave the host machine. You can also run ingest pipelines on the search cluster to rewrite matched fields like emails or card numbers.
What permissions does a Buildkite agent need in Elasticsearch?
An agent sending logs only needs permission to create documents in a specific build log index pattern. It should never have cluster admin rights or permission to read or delete existing indices.
Related guides
In this post