The Simplest Way to Make Azure Cosmosdb and Elastic Observability Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Teams pair azure cosmosdb and elastic observability to track database health and query speed. The database sends metrics and diagnostic logs to the search platform for fast alerts. This setup helps engineers spot slow queries, high request unit usage, and failed reads. How data and roles flow in azure cosmosdb and elastic observability Data moves from your cloud database into your search indexes through a clear pipeline. First, the database writes diagnostic logs and request metrics to cloud

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 azure cosmosdb and elastic observability to track database health and query speed. The database sends metrics and diagnostic logs to the search platform for fast alerts. This setup helps engineers spot slow queries, high request unit usage, and failed reads.

How data and roles flow in azure cosmosdb and elastic observability

Data moves from your cloud database into your search indexes through a clear pipeline. First, the database writes diagnostic logs and request metrics to cloud storage or event hubs. Next, a log shipper reads those events and sends them to the ingest node. The search cluster then parses each event and stores it in time-based indexes.

Identity and roles control every step of this data flow. Cloud identity roles allow the database to write logs to the event stream. A separate reader role lets the shipper pull those records out of the stream. On the search side, an ingest API key lets the shipper write new documents.

Engineers also need direct database read roles when an alert fires in the dashboard. A spike in latency pushes an on-call responder to inspect the live database collections. If the identity setup is weak, teams often copy master keys to run checks.

Common failure modes and how to scope roles and networks

Many teams make mistakes when they wire these two platforms together under tight deadlines. The most common error is using a shared master key for the log shipper. Another big risk is giving the ingest key full admin rights in the cluster. Teams also turn on full query logging without checking what data sits inside queries.

Full query logs often contain raw filter values from customer requests. Those filters can hold emails, phone numbers, card numbers, or national IDs. When the shipper sends raw logs, that private data lands in plain text indexes. Now every person with dashboard read rights can see private user details.

Unlogged live queries create another big blind spot during an incident. When an alert fires, engineers log in to the database with a shared account. The dashboard shows the slow metric, but no one tracks the manual fix queries. You can fix these gaps with strict role and network rules.

Azure RBAC + CosmosDB RBAC: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Start by replacing master database keys with managed cloud identities for all log pipelines. Give the log shipper a read-only role scoped to the single event stream. Create a dedicated ingest key in the search cluster that only writes to log indexes. Never let an ingest key delete indexes or read cluster settings.

Lock down the network path between your cloud account and the monitoring cluster. Use private endpoints so log traffic stays off the public internet. Set up firewall rules on the database to block unknown source networks.

Securing live database checks during incident response

Dashboards tell you that a partition is hot, but they cannot fix the data. Engineers still need to run direct queries against the database to inspect bad documents. Give each engineer an individual cloud identity instead of a shared team key.

Map those user identities to fine-grained database roles that only allow read commands. Keep write permissions locked away for rare cases that require a formal approval step. Use data masking to rewrite emails and card numbers in query results during checks. This keeps live debugging safe while your dashboards track overall system health.

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 do we send database logs to the search cluster without public traffic?

Route your diagnostic logs through a cloud event stream tied to a virtual network. Then use a private link service to send traffic to the ingest nodes.

How can we keep emails and card numbers out of our log indexes?

Turn off raw query text logging in the database diagnostic settings where possible. You can also set up ingest pipelines to rewrite matched fields before indexing documents.

Should the log shipper use a database master key to read metrics?

No, the shipper never needs direct database keys to collect platform logs. Use a managed cloud role that only reads from the diagnostic event hub.

The query runs. The emails stay hidden.