惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

B
Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Microsoft Security Blog
Microsoft Security Blog
B
Blog RSS Feed
云风的 BLOG
云风的 BLOG
G
Google Developers Blog
Recent Announcements
Recent Announcements
A
About on SuperTechFans
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Google Online Security Blog
Google Online Security Blog
Google DeepMind News
Google DeepMind News
S
Schneier on Security
S
Secure Thoughts
T
The Exploit Database - CXSecurity.com
Martin Fowler
Martin Fowler
P
Proofpoint News Feed
Security Latest
Security Latest
Jina AI
Jina AI
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Recorded Future
Recorded Future
T
Tor Project blog
有赞技术团队
有赞技术团队
H
Hackread – Cybersecurity News, Data Breaches, AI and More
N
News | PayPal Newsroom
博客园 - 三生石上(FineUI控件)
MyScale Blog
MyScale Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Last Week in AI
Last Week in AI
F
Full Disclosure
Hacker News: Ask HN
Hacker News: Ask HN
Forbes - Security
Forbes - Security
D
DataBreaches.Net
人人都是产品经理
人人都是产品经理
NISL@THU
NISL@THU
C
Cisco Blogs
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Google DeepMind News
Google DeepMind News
Project Zero
Project Zero
IT之家
IT之家
T
Threatpost
Cyberwarzone
Cyberwarzone
O
OpenAI News
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
J
Java Code Geeks
P
Proofpoint News Feed
The Last Watchdog
The Last Watchdog
月光博客
月光博客
Latest news
Latest news
MongoDB | Blog
MongoDB | Blog
Apple Machine Learning Research
Apple Machine Learning Research

Datadog | The Monitor blog

Introducing our open source AI-native SAST Instrument and monitor Boomi integration flows with OpenTelemetry and Datadog Not all index scans are equal: How we cut query latency by over 99% Platform engineering metrics: What to measure and what to ignore Integrate Recorded Future threat intelligence with Datadog Cloud SIEM CI/CD security: threat modeling using a MITRE-style threat matrix CI/CD security: How to secure your GitHub ecosystem Ingress NGINX is EOL: A practical guide for migrating to Kubernetes Gateway API Operating agentic AI with Amazon Bedrock AgentCore and Datadog LLM Observability: Lessons from NTT DATA Introducing the Datadog Code Security MCP Capture and analyze custom heatmaps in Session Replay Understand session replays faster with AI summaries and smart chapters Monitor ClickHouse query performance with Datadog Database Monitoring How we designed empathetic alert sounds for on-call engineers Search and act across Datadog to resolve issues faster with Bits Assistant Measure the business impact of every product change with Datadog Experiments Analyzing round trip query latency Configuring JavaScript caches for better performance Introducing Bits AI Dev Agent for Code Security Datadog achieves ISO 42001 certification for responsible AI Monitor Nutanix clusters, hosts, and VMs with Datadog Monitor Juniper Mist in Datadog A new Host Map for modern infrastructure Annotate traces to improve LLM quality with Datadog LLM Observability What’s new in Cloud SIEM: AI-powered investigations, enhanced threat intelligence, and scalable security operations Explore Kubernetes with native OpenTelemetry data Monitor Oracle Fusion Cloud Applications with Datadog Announcing the Datadog Terraform provider v4.0.0 Scaling Kubernetes workloads on custom metrics How to design cloud environments for AI-powered threat analysis Monitor Aruba Central in Datadog How we centralize and remediate risks with Datadog Case Management Accelerate incident response with Datadog and ServiceNow Monitor your application and network load balancer logs Understanding Karpenter architecture for Kubernetes autoscaling Tools for collecting metrics and logs from Karpenter Monitor Karpenter with Datadog What your product data is actually saying Key metrics for monitoring Karpenter Securing Datadog’s platform in the AI age: The role of observability data Four ways engineering teams use the Datadog MCP Server to power AI agents Approaching your observability migration with the right mindset Meet the new Bits AI SRE: Deeper reasoning, twice as fast Key learnings from the 2026 State of DevSecOps study Use plain English to query your multi-cloud infrastructure in Resource Catalog Simplifying troubleshooting across the user journey with Datadog Synthetic Monitoring Protect your OCI resources with Datadog Cloud Security This Month in Datadog - February 2026 Amazon EC2 security: How misconfigured and public AMIs expand your cloud attack surface Enable end-to-end visibility into your Java apps with a single command Measure and improve mobile app startup performance with Datadog RUM Evaluating our AI Guard application to improve quality and control cost Identify untested code across every level of your codebase Make use of guardrail metrics and stop babysitting your releases Monitor Versa Networks SD-WAN performance in Datadog Improve performance and reliability with APM Recommendations Remediate transitive vulnerabilities faster with Datadog Software Composition Analysis Generate audit-ready vulnerability and compliance reports with Datadog Sheets Monitor Fortinet FortiManager performance in Datadog Improve test coverage across codebases with Datadog Code Coverage Move fast, don’t break things: Consistent testing standards at scale Enrich logs with ServiceNow CMDB context before routing to any SIEM or logging tool Monitor Lustre with Datadog Make faster, better product decisions with Datadog Product Analytics Surface and remediate runtime posture issues with Workload Protection Findings Protect agentic AI applications with Datadog AI Guard How to optimize JavaScript code with CSS Trace Google Pub/Sub workloads in Cloud Run with Datadog Detect human names in logs with ML in Sensitive Data Scanner How we cut our NLQ agent debugging time from hours to minutes with LLM Observability Debug PostgreSQL query latency faster with EXPLAIN ANALYZE in Datadog Database Monitoring Datadog acquires Propolis Unify and correlate frontend and backend data with retention filters Scale compliance across global frameworks with Datadog Cloud Security Monitor Arista VeloCloud SD-WAN performance with Datadog Building reliable dashboard agents with Datadog LLM Observability Simplify log collection and aggregation for MSSPs with Datadog Observability Pipelines Mitigation for Node.js denial-of-service vulnerability affecting Datadog APM Automate flaky test fixes with the Bits AI Dev Agent and Test Optimization How we built an AI SRE agent that investigates like a team of engineers Datadog integrations 2025 recap: Observability for AI, security, and hybrid cloud Design effective executive dashboards with Datadog Implement dbt data quality checks with dbt-expectations Bring faster visibility into AWS Lambda functions with remote instrumentation Troubleshoot faster with the GitLab Source Code integration in Datadog How Cambia Health Solutions saved $30,000 monthly with Cloud Cost Management and the Datadog Resource Catalog Normalize any logs for Cloud SIEM with Datadog's OCSF processor Optimizing Datadog at scale: Cost-efficient observability at Zendesk Detect, diagnose, and resolve network issues easily with CNM Network Health Connect engineering errors to user impact in early-stage products Cilium configuration for Kubernetes operations at scale Designing feedback loops for progressive delivery Ship features faster and safer with Datadog Feature Flags Choosing the right OpenTelemetry Collector distribution Route your monitor alerts with Datadog monitor notification rules Automate Cloud SIEM investigations with Bits AI Security Analyst Cloud threat detection: How to identify risky activity across control and data planes Collecting Kafka performance metrics Monitoring Kafka with Datadog Monitoring Kafka performance metrics
Tools for collecting etcd metrics and logs
David Lentz · 2024-02-23 · via Datadog | The Monitor blog

In Part 1 of this series, we looked at how etcd works and the role it plays in managing the state of a Kubernetes cluster. We also explored key etcd metrics you should monitor to ensure the health and performance of your etcd cluster. In this post, we’ll show you how you can use tools like Prometheus, Grafana, and etcdctl to collect and visualize etcd metrics. We’ll also show you how to collect etcd logs that provide context for those metrics.

Collect and visualize etcd metrics

Each server in your etcd cluster exposes metrics in the standard Prometheus format. In this section, we’ll show you how you can view these metrics and how you can collect, store, and visualize them.

View a snapshot via the /metrics endpoint

Each node in your etcd cluster exposes metrics at the /metrics endpoint, which is enabled by default. In this section, we’ll show you how to use curl to view current values for all available metrics, so you can always see a snapshot of your etcd servers’ performance.

Etcd supports using mutual TLS (mTLS) to secure the communication with clients (such as curl and kube-apiserver) and among the peers within the cluster. Once you’ve configured your etcd servers to use the necessary certificates, you can communicate securely by passing authentication information with your request. The command shown below calls the /metrics endpoint and specifies the TLS client certificate (--cert), client key (--key), and certificate authority (--cacert) to secure the communication. The command is prefaced with sudo to provide the privileges necessary to access the certificate files. It uses an example IP address but the port shown—2379—is the default port that all etcd nodes use for client communication.

sudo curl --cert /etc/etcd/kubernetes.pem --key /etc/etcd/kubernetes-key.pem --cacert /etc/etcd/ca.pem https://10.240.0.10:2379/metrics

The sample output shows an excerpt of the etcd server’s reply. This snapshot includes the current values of the commit duration, cluster leadership status, and heartbeat metrics:

[...]

# HELP etcd_debugging_disk_backend_commit_write_duration_seconds The latency distributions of commit.write called by bboltdb backend.

# TYPE etcd_debugging_disk_backend_commit_write_duration_seconds histogram

etcd_debugging_disk_backend_commit_write_duration_seconds_bucket{le="0.001"} 1

etcd_debugging_disk_backend_commit_write_duration_seconds_bucket{le="0.002"} 638

etcd_debugging_disk_backend_commit_write_duration_seconds_bucket{le="0.004"} 3333

etcd_debugging_disk_backend_commit_write_duration_seconds_bucket{le="0.008"} 3339

etcd_debugging_disk_backend_commit_write_duration_seconds_bucket{le="0.016"} 3341

etcd_debugging_disk_backend_commit_write_duration_seconds_bucket{le="0.032"} 3341

etcd_debugging_disk_backend_commit_write_duration_seconds_bucket{le="0.064"} 3341

etcd_debugging_disk_backend_commit_write_duration_seconds_bucket{le="0.128"} 3341

etcd_debugging_disk_backend_commit_write_duration_seconds_bucket{le="0.256"} 3342

etcd_debugging_disk_backend_commit_write_duration_seconds_bucket{le="0.512"} 3342

etcd_debugging_disk_backend_commit_write_duration_seconds_bucket{le="1.024"} 3342

etcd_debugging_disk_backend_commit_write_duration_seconds_bucket{le="2.048"} 3342

etcd_debugging_disk_backend_commit_write_duration_seconds_bucket{le="4.096"} 3342

etcd_debugging_disk_backend_commit_write_duration_seconds_bucket{le="8.192"} 3342

etcd_debugging_disk_backend_commit_write_duration_seconds_bucket{le="+Inf"} 3342

etcd_debugging_disk_backend_commit_write_duration_seconds_sum 7.666080665000013

etcd_debugging_disk_backend_commit_write_duration_seconds_count 3342

[...]

# HELP etcd_server_has_leader Whether or not a leader exists. 1 is existence, 0 is not.

# TYPE etcd_server_has_leader gauge

etcd_server_has_leader 1

[...]

# HELP etcd_server_heartbeat_send_failures_total The total number of leader heartbeat send failures (likely overloaded from slow disk).

# TYPE etcd_server_heartbeat_send_failures_total counter

etcd_server_heartbeat_send_failures_total 0

Expand your etcd visibility with Prometheus and Grafana

The /metrics endpoint displays the current values of etcd metrics, but you can track your cluster’s performance over time by running a Prometheus server. The etcd documentation provides guidance on configuring Prometheus monitoring in your etcd cluster.

You can use Grafana to see history, trends, and patterns in the values of metrics stored in Prometheus. Etcd provides a pre-built Grafana dashboard (shown below) that includes key metrics, such as leader changes and failed proposals.

A Grafana dashboard shows Prometheus metrics over time.

Check endpoint health and performance with etcdctl

Etcd’s command-line tool—etcdctl—allows you to execute simple tests and query the status of your etcd nodes. In this section, we’ll show you how you can use etcdctl to gather information about your cluster for troubleshooting and analysis. Note that in the sample commands shown throughout this section, we have created an environment variable called ETCDCTL_API that specifies the etcdctl version to use—see the documentation for more information on the available versions.

The check perf subcommand sends write requests to one or more etcd nodes and measures the throughput and latency of those operations. The sample command shown below uses the --endpoints option to specify which of the cluster’s nodes to check.

sudo ETCDCTL_API=3 etcdctl --endpoints=https://10.240.0.10:2379 --cacert=/etc/etcd/ca.pem --cert=/etc/etcd/kubernetes.pem --key=/etc/etcd/kubernetes-key.pem check perf

The output of check perf summarizes the test results and—in this example—indicates that the node has passed the test.

PASS: Throughput is 150 writes/s

PASS: Slowest request took 0.095848s

PASS: Stddev is 0.003297s

PASS

The endpoint health subcommand tests the time required for each node in the cluster to commit a test proposal. The example command below uses the --cluster option to specify that all nodes in the cluster should be checked.

sudo ETCDCTL_API=3 etcdctl --cluster --cacert=/etc/etcd/ca.pem --cert=/etc/etcd/kubernetes.pem --key=/etc/etcd/kubernetes-key.pem endpoint health

Checking the health of the entire cluster can help you focus your troubleshooting by quickly identifying any unhealthy nodes. The output below shows that four of the endpoints responded successfully, but etcdctl was unable to reach the other endpoint and returned the context deadline exceeded error. Because not all nodes passed the test, etcdctl returned an unhealthy cluster error.

https://10.240.0.10:2379 is healthy: successfully committed proposal: took = 9.562129ms

https://10.240.0.11:2379 is healthy: successfully committed proposal: took = 12.199038ms

https://10.240.0.12:2379 is unhealthy: failed to commit proposal: context deadline exceeded

https://10.240.0.13:2379 is healthy: successfully committed proposal: took = 21.537375ms

https://10.240.0.14:2379 is healthy: successfully committed proposal: took = 20.272916ms

Error: unhealthy cluster

The endpoint status subcommand can help you troubleshoot etcd by showing you each node’s database size, error messages (if any), and Raft status—including its role as a leader or follower and the most recent log entries it has committed and applied. The example command below uses the --write-out=table option to format the output. Other formatting options include json and fields, which writes the output as a list.

sudo ETCDCTL_API=3 etcdctl --cluster --write-out=table --cacert=/etc/etcd/ca.pem --cert=/etc/etcd/kubernetes.pem --key=/etc/etcd/kubernetes-key.pem endpoint status

The sample output below shows no errors pending on any of the nodes.

+--------------------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+

| ENDPOINT | ID | VERSION | DB SIZE | IS LEADER | IS LEARNER | RAFT TERM | RAFT INDEX | RAFT APPLIED INDEX | ERRORS |

+--------------------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+

| https://10.240.0.13:2379 | 2fe2f5d17fc97dab | 3.5.9 | 22 MB | false | false | 2 | 9002 | 9002 | |

| https://10.240.0.12:2379 | 3a57933972cb5131 | 3.5.9 | 22 MB | false | false | 2 | 9002 | 9002 | |

| https://10.240.0.14:2379 | 5e3509fb8e8c6cae | 3.5.9 | 22 MB | false | false | 2 | 9002 | 9002 | |

| https://10.240.0.10:2379 | f98dc20bce6225a0 | 3.5.9 | 22 MB | false | false | 2 | 9002 | 9002 | |

| https://10.240.0.11:2379 | ffed16798470cab5 | 3.5.9 | 22 MB | true | false | 2 | 9002 | 9002 | |

+--------------------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+

Use journalctl to view etcd logs

Metrics and health data can help you understand the state of your etcd cluster, and you can gain greater context around that data by collecting and exploring etcd logs. These logs provide information about the etcd process (such as startup, shutdown, and errors), as well as etcd activity, including reads, writes, and leader elections.

Etcd uses the zap library to structure its logs. Each log contains a JSON object that identifies the node and log level (e.g., warn, or error), as well as a message and other data that can help you troubleshoot.

By default, etcd sends logs to journald, which is the service that processes logs from applications managed by systemd. The example command below shows how you can use journald’s command-line tool—journalctl—to browse the logs on an etcd node.

journalctl _SYSTEMD_UNIT=etcd.service

The sample output shown below shows details of a leader election.

Dec 21 21:23:07 controller-0 etcd[1950]: {"level":"info","ts":"2023-12-21T21:23:07.76964Z","logger":"raft","caller":"etcdserver/zap_raft.go:77","msg":"f98dc20bce6225a0 became candidate at term 2"}

Dec 21 21:23:07 controller-0 etcd[1950]: {"level":"info","ts":"2023-12-21T21:23:07.769719Z","logger":"raft","caller":"etcdserver/zap_raft.go:77","msg":"f98dc20bce6225a0 received MsgVoteResp from f98dc20bce6225a0 at term 2"}

Dec 21 21:23:07 controller-0 etcd[1950]: {"level":"info","ts":"2023-12-21T21:23:07.769739Z","logger":"raft","caller":"etcdserver/zap_raft.go:77","msg":"f98dc20bce6225a0 [logterm: 1, index: 3] sent MsgVote request to 3a57933972cb5131 at term 2"}

Dec 21 21:23:07 controller-0 etcd[1950]: {"level":"info","ts":"2023-12-21T21:23:07.769796Z","logger":"raft","caller":"etcdserver/zap_raft.go:77","msg":"f98dc20bce6225a0 [logterm: 1, index: 3] sent MsgVote request to ffed16798470cab5 at term 2"}

Dec 21 21:23:07 controller-0 etcd[1950]: {"level":"info","ts":"2023-12-21T21:23:07.773656Z","logger":"raft","caller":"etcdserver/zap_raft.go:77","msg":"f98dc20bce6225a0 received MsgVoteResp from ffed16798470cab5 at term 2"}

Dec 21 21:23:07 controller-0 etcd[1950]: {"level":"info","ts":"2023-12-21T21:23:07.773714Z","logger":"raft","caller":"etcdserver/zap_raft.go:77","msg":"f98dc20bce6225a0 has received 2 MsgVoteResp votes and 0 vote rejections"}

Dec 21 21:23:07 controller-0 etcd[1950]: {"level":"info","ts":"2023-12-21T21:23:07.773738Z","logger":"raft","caller":"etcdserver/zap_raft.go:77","msg":"f98dc20bce6225a0 became leader at term 2"}

Dec 21 21:23:07 controller-0 etcd[1950]: {"level":"info","ts":"2023-12-21T21:23:07.773755Z","logger":"raft","caller":"etcdserver/zap_raft.go:77","msg":"raft.node: f98dc20bce6225a0 elected leader f98dc20bce6225a0 at term 2"}

If you prefer not to use journald—for example, if you’re using a platform that doesn’t support systemd or you need to implement a lightweight logging solution that doesn’t require it—you can configure etcd to send logs to stderr or stdout.

You can also configure etcd’s log level. By default, you’ll collect logs designated as info-level and higher, but you can instead use the debug level for more verbose logging. This level also makes additional data available under the /debug endpoint, including profiling data from the pprof Go package, as well as request and trace data. This additional data can be useful for examining etcd’s behavior in development environments or troubleshooting production issues. But using the debug log level can degrade the performance of your etcd cluster and increase the volume of your logs, so you should use it only when necessary.

Monitor etcd and Kubernetes with Datadog

In this post, we’ve shown you the tools and processes you can use to collect and view metrics and logs from your etcd clusters. In Part 3 of this series, we’ll show you how Datadog gives you visibility into your etcd metrics and logs—alongside data from your Kubernetes control plane and workloads, plus the infrastructure that runs it all—in one unified platform.